(()=>{var lo=Object.defineProperty,ho=Object.defineProperties;var co=Object.getOwnPropertyDescriptors;var Wt=Object.getOwnPropertySymbols;var sr=Object.prototype.hasOwnProperty,rr=Object.prototype.propertyIsEnumerable;var es=(t,e,i)=>e in t?lo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,O=(t,e)=>{for(var i in e||(e={}))sr.call(e,i)&&es(t,i,e[i]);if(Wt)for(var i of Wt(e))rr.call(e,i)&&es(t,i,e[i]);return t},Ce=(t,e)=>ho(t,co(e));var nr=(t,e)=>{var i={};for(var s in t)sr.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(t!=null&&Wt)for(var s of Wt(t))e.indexOf(s)<0&&rr.call(t,s)&&(i[s]=t[s]);return i};var ts=(t,e,i)=>(es(t,typeof e!="symbol"?e+"":e,i),i);var P=(t,e,i)=>new Promise((s,r)=>{var n=l=>{try{a(i.next(l))}catch(c){r(c)}},o=l=>{try{a(i.throw(l))}catch(c){r(c)}},a=l=>l.done?s(l.value):Promise.resolve(l.value).then(n,o);a((i=i.apply(t,e)).next())});var De=class{constructor(e={}){e=Object.assign({resolveTimeout:null,resolveValue:!0,rejectTimeout:null,rejectValue:!1},e),this._promise=new Promise((o,a)=>{this.resolve=o,this.reject=a}),this.then=this._promise.then.bind(this._promise),this.catch=this._promise.catch.bind(this._promise),this.finally=this._promise.finally.bind(this._promise),this[Symbol.toStringTag]="Promise";let{resolveTimeout:i,resolveValue:s,rejectTimeout:r,rejectValue:n}=e;i&&setTimeout(()=>this.resolve(s),i),r&&setTimeout(()=>this.reject(n),r)}};var or="layer";function ar(t,e){document.dispatchEvent(new CustomEvent("doofinder.register",{detail:{name:t,entrypoint:e}}))}var wt=t=>typeof t=="function"?t:function(){return t},uo=typeof self!="undefined"?self:null,At=typeof window!="undefined"?window:null,Ke=uo||At||Ke,fo="2.0.0",ke={connecting:0,open:1,closing:2,closed:3},po=1e4,mo=1e3,pe={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Oe={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},is={longpoll:"longpoll",websocket:"websocket"},go={complete:4},Kt=class{constructor(t,e,i,s){this.channel=t,this.event=e,this.payload=i||function(){return{}},this.receivedResp=null,this.timeout=s,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:t,response:e,_ref:i}){this.recHooks.filter(s=>s.status===t).forEach(s=>s.callback(e))}cancelRefEvent(){!this.refEvent||this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},lr=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},_o=class{constructor(t,e,i){this.state=pe.closed,this.topic=t,this.params=wt(e||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Kt(this,Oe.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new lr(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=pe.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(s=>s.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=pe.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=pe.closed,this.socket.remove(this)}),this.onError(s=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,s),this.isJoining()&&this.joinPush.reset(),this.state=pe.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Kt(this,Oe.leave,wt({}),this.timeout).send(),this.state=pe.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Oe.reply,(s,r)=>{this.trigger(this.replyEventName(r),s)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(t){this.on(Oe.close,t)}onError(t){return this.on(Oe.error,e=>t(e))}on(t,e){let i=this.bindingRef++;return this.bindings.push({event:t,ref:i,callback:e}),i}off(t,e){this.bindings=this.bindings.filter(i=>!(i.event===t&&(typeof e=="undefined"||e===i.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,i=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let s=new Kt(this,t,function(){return e},i);return this.canPush()?s.send():(s.startTimeout(),this.pushBuffer.push(s)),s}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=pe.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Oe.close,"leave")},i=new Kt(this,Oe.leave,wt({}),t);return i.receive("ok",()=>e()).receive("timeout",()=>e()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(t,e,i){return e}isMember(t,e,i,s){return this.topic!==t?!1:s&&s!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:i,joinRef:s}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=pe.joining,this.joinPush.resend(t))}trigger(t,e,i,s){let r=this.onMessage(t,e,i,s);if(e&&!r)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let n=this.bindings.filter(o=>o.event===t);for(let o=0;o{let a=this.parseJSON(t.responseText);o&&o(a)},n&&(t.ontimeout=n),t.onprogress=()=>{},t.send(s),t}static xhrRequest(t,e,i,s,r,n,o,a){return t.open(e,i,!0),t.timeout=n,t.setRequestHeader("Content-Type",s),t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===go.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(r),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch(e){return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let i=[];for(var s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let r=e?`${e}[${s}]`:s,n=t[s];typeof n=="object"?i.push(this.serialize(n,r)):i.push(encodeURIComponent(r)+"="+encodeURIComponent(n))}return i.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let i=t.match(/\?/)?"&":"?";return`${t}${i}${this.serialize(e)}`}},vo=t=>{let e="",i=new Uint8Array(t),s=i.byteLength;for(let r=0;rthis.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+is.websocket),"$1/"+is.longpoll)}endpointURL(){return zt.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,i){this.close(t,e,i),this.readyState=ke.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===ke.open||this.readyState===ke.connecting}poll(){this.ajax("GET","application/json",null,()=>this.ontimeout(),t=>{if(t){var{status:e,token:i,messages:s}=t;this.token=i}else e=0;switch(e){case 200:s.forEach(r=>{setTimeout(()=>this.onmessage({data:r}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=ke.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${e}`)}})}send(t){typeof t!="string"&&(t=vo(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST","application/x-ndjson",t.join(` `),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,i){for(let r of this.reqs)r.abort();this.readyState=ke.closed;let s=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:i});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent!="undefined"?this.onclose(new CloseEvent("close",s)):this.onclose(s)}ajax(t,e,i,s,r){let n,o=()=>{this.reqs.delete(n),s()};n=zt.request(t,this.endpointURL(),e,i,this.timeout,o,a=>{this.reqs.delete(n),this.isActive()&&r(a)}),this.reqs.add(n)}};var Gt={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let i=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(i))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[i,s,r,n,o]=JSON.parse(t);return e({join_ref:i,ref:s,topic:r,event:n,payload:o})}},binaryEncode(t){let{join_ref:e,ref:i,event:s,topic:r,payload:n}=t,o=this.META_LENGTH+e.length+i.length+r.length+s.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,i.length),l.setUint8(c++,r.length),l.setUint8(c++,s.length),Array.from(e,m=>l.setUint8(c++,m.charCodeAt(0))),Array.from(i,m=>l.setUint8(c++,m.charCodeAt(0))),Array.from(r,m=>l.setUint8(c++,m.charCodeAt(0))),Array.from(s,m=>l.setUint8(c++,m.charCodeAt(0)));var f=new Uint8Array(a.byteLength+n.byteLength);return f.set(new Uint8Array(a),0),f.set(new Uint8Array(n),a.byteLength),f.buffer},binaryDecode(t){let e=new DataView(t),i=e.getUint8(0),s=new TextDecoder;switch(i){case this.KINDS.push:return this.decodePush(t,e,s);case this.KINDS.reply:return this.decodeReply(t,e,s);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,s)}},decodePush(t,e,i){let s=e.getUint8(1),r=e.getUint8(2),n=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=i.decode(t.slice(o,o+s));o=o+s;let l=i.decode(t.slice(o,o+r));o=o+r;let c=i.decode(t.slice(o,o+n));o=o+n;let f=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:f}},decodeReply(t,e,i){let s=e.getUint8(1),r=e.getUint8(2),n=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=i.decode(t.slice(a,a+s));a=a+s;let c=i.decode(t.slice(a,a+r));a=a+r;let f=i.decode(t.slice(a,a+n));a=a+n;let m=i.decode(t.slice(a,a+o));a=a+o;let v=t.slice(a,t.byteLength),E={status:m,response:v};return{join_ref:l,ref:c,topic:f,event:Oe.reply,payload:E}},decodeBroadcast(t,e,i){let s=e.getUint8(1),r=e.getUint8(2),n=this.HEADER_LENGTH+2,o=i.decode(t.slice(n,n+s));n=n+s;let a=i.decode(t.slice(n,n+r));n=n+r;let l=t.slice(n,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},hr=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=e.timeout||po,this.transport=e.transport||Ke.WebSocket||Tt,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=e.sessionStorage||Ke&&Ke.sessionStorage,this.establishedConnections=0,this.defaultEncoder=Gt.encode.bind(Gt),this.defaultDecoder=Gt.decode.bind(Gt),this.closeWasClean=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Tt?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let i=null;At&&At.addEventListener&&(At.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),i=this.connectClock)}),At.addEventListener("pageshow",s=>{i===this.connectClock&&(i=null,this.connect())})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.rejoinAfterMs=s=>e.rejoinAfterMs?e.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>e.reconnectAfterMs?e.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(s,r,n)=>{console.log(`${s}: ${r}`,n)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=wt(e.params||{}),this.endPoint=`${t}/${is.websocket}`,this.vsn=e.vsn||fo,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new lr(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return Tt}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=zt.appendParams(zt.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,i){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(t,e,i)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=wt(t)),!this.conn&&(this.longPollFallbackMs&&this.transport!==Tt?this.connectWithFallback(Tt,this.longPollFallbackMs):this.transportConnect())}log(t,e,i){this.logger&&this.logger(t,e,i)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),i=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let s=this.onMessage(r=>{r.ref===e&&(this.off([s]),t(Date.now()-i))});return!0}transportConnect(){this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let i=!1,s=!0,r,n,o=a=>{this.log("transport",`falling back to ${t.name}...`,a),this.off([r,n]),s=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${t.name}`))return o("memorized");this.fallbackTimer=setTimeout(o,e),n=this.onError(a=>{this.log("transport","error",a),s&&!i&&(clearTimeout(this.fallbackTimer),o(a))}),this.onOpen(()=>{if(i=!0,!s)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t.name}`,"true"),this.log("transport",`established ${t.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,e),this.ping(a=>{this.log("transport","connected to primary after",a),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,t])=>t())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),mo,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,i){if(!this.conn)return t&&t();this.waitForBufferDone(()=>{this.conn&&(e?this.conn.close(e,i||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e=1){if(e===5||!this.conn||!this.conn.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(t,e+1)},150*e)}waitForSocketClosed(t,e=1){if(e===5||!this.conn||this.conn.readyState===ke.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(t,e+1)},150*e)}onConnClose(t){let e=t&&t.code;this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&e!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,i])=>i(t))}onConnError(t){this.hasLogger()&&this.log("transport",t);let e=this.transport,i=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,s])=>{s(t,e,i)}),(e===this.transport||i>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Oe.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case ke.connecting:return"connecting";case ke.open:return"open";case ke.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([i])=>t.indexOf(i)===-1)}channel(t,e={}){let i=new _o(t,e,this);return this.channels.push(i),i}push(t){if(this.hasLogger()){let{topic:e,event:i,payload:s,ref:r,join_ref:n}=t;this.log("push",`${e} ${i} (${n}, ${r})`,s)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:i,event:s,payload:r,ref:n,join_ref:o}=e;n&&n===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${i} ${s} ${n&&"("+n+")"||""}`,r);for(let a=0;ai.topic===t&&(i.isJoined()||i.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};var cr=(t,e,i)=>{e.forEach(s=>{t.addEventListener(s,i)})},dr=(t,e,i)=>{e.forEach(s=>{t.removeEventListener(s,i)})},ss=class{constructor(e){this.defaults={idle:1e4,events:["mousemove","scroll","keydown","mousedown","touchstart"],onIdle:null,onActive:null,onHide:null,onShow:null,keepTracking:!0,startAtIdle:!1,recurIdleCall:!1},this.throwOnBadKey(Object.keys(e),Object.keys(this.defaults)),this.settings=Object.assign({},this.defaults,e),this.visibilityEvents=["visibilitychange","webkitvisibilitychange","mozvisibilitychange","msvisibilitychange"],this.clearTimeout=null,this.reset(),this.stopListener=i=>{this.stop()},this.idlenessEventsHandler=i=>{this.idle&&(this.idle=!1,this.settings.onActive&&this.settings.onActive.call()),this.resetTimeout(this.settings)},this.visibilityEventsHandler=i=>{document.hidden||document.webkitHidden||document.mozHidden||document.msHidden?this.visible&&(this.visible=!1,this.settings.onHide&&this.settings.onHide.call()):this.visible||(this.visible=!0,this.settings.onShow&&this.settings.onShow.call())}}resetTimeout(e,i=this.settings.keepTracking){this.clearTimeout&&(this.clearTimeout(),this.clearTimeout=null),i&&this.timeout(this.settings)}timeout(e){var i=this.settings.recurIdleCall?{set:setInterval.bind(window),clear:clearInterval.bind(window)}:{set:setTimeout.bind(window),clear:clearTimeout.bind(window)},s=i.set(function(){this.idle=!0,this.settings.onIdle&&this.settings.onIdle.call()}.bind(this),this.settings.idle);this.clearTimeout=()=>i.clear(s)}start(){return window.addEventListener("idle:stop",this.stopListener),this.timeout(this.settings),cr(window,this.settings.events,this.idlenessEventsHandler),(this.settings.onShow||this.settings.onHide)&&cr(document,this.visibilityEvents,this.visibilityEventsHandler),this}stop(){return window.removeEventListener("idle:stop",this.stopListener),dr(window,this.settings.events,this.idlenessEventsHandler),this.resetTimeout(this.settings,!1),(this.settings.onShow||this.settings.onHide)&&dr(document,this.visibilityEvents,this.visibilityEventsHandler),this}reset({idle:e=this.settings.startAtIdle,visible:i=!this.settings.startAtIdle}={}){return this.idle=e,this.visible=i,this}throwOnBadKey(e,i){e.forEach(function(s){if(!i.includes(s))throw`set: Unknown key ${s}`})}set(e){this.throwOnBadKey(Object.keys(e),Object.keys(this.defaults)),this.settings=Object.assign(this.settings,e)}};var rs=class extends hr{constructor(e,i={}){super(e,i);this.preventReconnect=!1,this.shouldReconnect=!1,this.idleMonitor=new ss({idle:3*60*1e3,onActive:this.onShowOrActive.bind(this),onShow:this.onShowOrActive.bind(this)}),this.idleMonitor.start()}onShowOrActive(){this.shouldReconnect&&this.idleMonitor.visible&&!this.idleMonitor.idle&&(this.shouldReconnect=!1,this.reconnectTimer.scheduleTimeout())}onConnClose(e){this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),this.preventReconnect||(this.closeWasClean?this.idleMonitor.stop():this.scheduleReconnect()),this.stateChangeCallbacks.close.forEach(([,i])=>i(e))}scheduleReconnect(){!this.idleMonitor.idle&&this.idleMonitor.visible?this.reconnectTimer.scheduleTimeout():(this.reconnectTimer.reset(),this.shouldReconnect=!0)}};var $="search",Yt="consecutive-reloads",ur=10,fr=5e3,pr=1e4,mr=3e4,Qt=["phx-click-loading","phx-change-loading","phx-submit-loading","phx-keydown-loading","phx-keyup-loading","phx-blur-loading","phx-focus-loading","phx-hook-loading"],me="data-phx-component";var gr="track-static";var oe="data-phx-ref",Pe="data-phx-ref-src",Zt="track-uploads",ge="data-phx-upload-ref",at="data-phx-preflighted-refs",_r="data-phx-done-refs",ns="drop-target",xt="data-phx-active-refs",lt=`${$}:live-file:updated`,ei="data-phx-skip",ti="data-phx-id",os="data-phx-prune",as="page-loading",ls="phx-connected",ht="phx-loading",Ct="phx-no-feedback",kt="phx-error",hs="phx-client-error",ii="phx-server-error",ze="data-phx-parent-id",si="data-phx-main",Re="data-dfd-root-id",ri="viewport-top",ni="viewport-bottom",vr="trigger-action",Ge="feedback-for",Ye="feedback-group",Pt="phx-has-focused",br=["text","textarea","number","email","password","search","tel","url","date","time","datetime-local","color","range"],oi=["checkbox","radio"],ct="phx-has-submitted",ve="data-dfd-view",He=`[${ve}]`,cs="data-phx-sticky",$e="data-phx-static",ai="data-phx-readonly",Qe="data-phx-disabled",Rt="disable-with",It="data-phx-disable-with-restore",dt="hook",yr="debounce",Sr="throttle",ut="update",li="stream",hi="data-phx-stream",Er="key",Ee="phxPrivate",ds="auto-recover",Lt="phx:live-socket:debug",ci="phx:live-socket:profiling",di="phx:live-socket:latency-sim",wr="progress",us="mounted",Ar=1,Tr=200,xr="dfd-",Cr=3e4;var ft="debounce-trigger",pt="throttled",fs="debounce-prev-key",kr={debounce:300,throttle:300},Dt="d",we="s",ui="r",ae="c",ps="e",ms="r",gs="t",Pr="p",_s="stream";var fi=class{constructor(e,i,s){this.liveSocket=s,this.entry=e,this.offset=0,this.chunkSize=i,this.chunkTimer=null,this.errored=!1,this.uploadChannel=s.channel(`lvu:${e.ref}`,{token:e.metadata()})}error(e){this.errored||(this.uploadChannel.leave(),this.errored=!0,clearTimeout(this.chunkTimer),this.entry.error(e))}upload(){this.uploadChannel.onError(e=>this.error(e)),this.uploadChannel.join().receive("ok",e=>this.readNextChunk()).receive("error",e=>this.error(e))}isDone(){return this.offset>=this.entry.file.size}readNextChunk(){let e=new window.FileReader,i=this.entry.file.slice(this.offset,this.chunkSize+this.offset);e.onload=s=>{if(s.target.error===null)this.offset+=s.target.result.byteLength,this.pushChunk(s.target.result);else return ie("Read error: "+s.target.error)},e.readAsArrayBuffer(i)}pushChunk(e){!this.uploadChannel.isJoined()||this.uploadChannel.push("chunk",e).receive("ok",()=>{this.entry.progress(this.offset/this.entry.file.size*100),this.isDone()||(this.chunkTimer=setTimeout(()=>this.readNextChunk(),this.liveSocket.getLatencySim()||0))}).receive("error",({reason:i})=>this.error(i))}};var ie=(t,e)=>console.error&&console.error(t,e),be=t=>{let e=typeof t;return e==="number"||e==="string"&&/^(0|[1-9]\d*)$/.test(t)};function Rr(t=document){let e=new Set,i=t.querySelectorAll("*[id]");for(let s=0,r=i.length;s{t.liveSocket.isDebugEnabled()&&console.log(`${t.id} ${e}: ${i} - `,s)},pi=t=>typeof t=="function"?t:function(){return t},mt=t=>JSON.parse(JSON.stringify(t)),gt=(t,e,i)=>{do{if(t.matches(`[${e}]`)&&!t.disabled)return t;t=t.parentElement||t.parentNode}while(t!==null&&t.nodeType===1&&!(i&&i.isSameNode(t)||t.matches(He)));return null},Ze=t=>t!==null&&typeof t=="object"&&!(t instanceof Array),Lr=(t,e)=>JSON.stringify(t)===JSON.stringify(e),vs=t=>{for(let e in t)return!1;return!0},Ae=(t,e)=>t&&e(t),Dr=function(t,e,i,s){t.forEach(r=>{new fi(r,i.config.chunk_size,s).upload()})};var Or={canPushState(){return typeof history.pushState!="undefined"},dropLocal(t,e,i){return t.removeItem(this.localKey(e,i))},updateLocal(t,e,i,s,r){let n=this.getLocal(t,e,i),o=this.localKey(e,i),a=n===null?s:r(n);return t.setItem(o,JSON.stringify(a)),a},getLocal(t,e,i){return JSON.parse(t.getItem(this.localKey(e,i)))},updateCurrentState(t){!this.canPushState()||history.replaceState(t(history.state||{}),"",window.location.href)},pushState(t,e,i){if(this.canPushState()){if(i!==window.location.href){if(e.type=="redirect"&&e.scroll){let r=history.state||{};r.scroll=e.scroll,history.replaceState(r,"",window.location.href)}delete e.scroll,history[t+"State"](e,"",i||null);let s=this.getHashTargetEl(window.location.hash);s?s.scrollIntoView():e.type==="redirect"&&window.scroll(0,0)}}else this.redirect(i)},setCookie(t,e){document.cookie=`${t}=${e}`},getCookie(t){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${t}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(t,e){e&&Or.setCookie("__phoenix_flash__",e+"; max-age=60000; path=/"),window.location=t},localKey(t,e){return`${t}-${e}`},getHashTargetEl(t){let e=t.toString().substring(1);if(e!=="")return document.getElementById(e)||document.querySelector(`a[name="${e}"]`)}},Ie=Or;var bo={focusMain(){let t=document.querySelector("main h1, main, h1");if(t){let e=t.tabIndex;t.tabIndex=-1,t.focus(),t.tabIndex=e}},anyOf(t,e){return e.find(i=>t instanceof i)},isFocusable(t,e){return t instanceof HTMLAnchorElement&&t.rel!=="ignore"||t instanceof HTMLAreaElement&&t.href!==void 0||!t.disabled&&this.anyOf(t,[HTMLInputElement,HTMLSelectElement,HTMLTextAreaElement,HTMLButtonElement])||t instanceof HTMLIFrameElement||t.tabIndex>0||!e&&t.getAttribute("tabindex")!==null&&t.getAttribute("aria-hidden")!=="true"},attemptFocus(t,e){if(this.isFocusable(t,e))try{t.focus()}catch(i){}return!!document.activeElement&&document.activeElement.isSameNode(t)},focusFirstInteractive(t){let e=t.firstElementChild;for(;e;){if(this.attemptFocus(e,!0)||this.focusFirstInteractive(e,!0))return!0;e=e.nextElementSibling}},focusFirst(t){let e=t.firstElementChild;for(;e;){if(this.attemptFocus(e)||this.focusFirst(e))return!0;e=e.nextElementSibling}},focusLast(t){let e=t.lastElementChild;for(;e;){if(this.attemptFocus(e)||this.focusLast(e))return!0;e=e.previousElementSibling}}},Ue=bo;var mi=null,Hr=200,yo={exec(t,e,i,s,r){let[n,o]=r||[null,{callback:r&&r.callback}];(e.charAt(0)==="["?JSON.parse(e):[[n,o]]).forEach(([l,c])=>{l===n&&o.data&&(c.data=Object.assign(c.data||{},o.data),c.callback=c.callback||o.callback),this.filterToEls(s,c).forEach(f=>{this[`exec_${l}`](t,e,i,s,f,c)})})},isVisible(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length>0)},isInViewport(t){let e=t.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth;return e.right>0&&e.bottom>0&&e.left{let c=l.getAttribute(n);if(!c)throw new Error(`expected ${n} to contain JS command on "${o}"`);i.liveSocket.execJS(l,c,t)})},exec_dispatch(t,e,i,s,r,{to:n,event:o,detail:a,bubbles:l}){a=a||{},a.dispatcher=s,p.dispatchEvent(r,o,{detail:a,bubbles:l})},exec_push(t,e,i,s,r,n){let{event:o,data:a,target:l,page_loading:c,loading:f,value:m,dispatcher:v,callback:E}=n,b={loading:f,value:m,target:l,page_loading:!!c},w=t==="change"&&v?v:s,N=l||w.getAttribute(i.binding("target"))||w;i.withinTargets(N,(L,I)=>{if(!!L.isConnected())if(t==="change"){let{newCid:B,_target:q}=n;q=q||(p.isFormInput(s)?s.name:void 0),q&&(b._target=q),L.pushInput(s,I,B,o||e,b,E)}else if(t==="submit"){let{submitter:B}=n;L.submitForm(s,I,o||e,B,b,E)}else L.pushEvent(t,s,I,o||e,a,b,E)})},exec_navigate(t,e,i,s,r,{href:n,replace:o}){i.liveSocket.historyRedirect(n,o?"replace":"push")},exec_patch(t,e,i,s,r,{href:n,replace:o}){i.liveSocket.pushHistoryPatch(n,o?"replace":"push",s)},exec_focus(t,e,i,s,r){window.requestAnimationFrame(()=>Ue.attemptFocus(r))},exec_focus_first(t,e,i,s,r){window.requestAnimationFrame(()=>Ue.focusFirstInteractive(r)||Ue.focusFirst(r))},exec_push_focus(t,e,i,s,r){window.requestAnimationFrame(()=>mi=r||s)},exec_pop_focus(t,e,i,s,r){window.requestAnimationFrame(()=>{mi&&mi.focus(),mi=null})},exec_add_class(t,e,i,s,r,{names:n,transition:o,time:a}){this.addOrRemoveClasses(r,n,[],o,a,i)},exec_remove_class(t,e,i,s,r,{names:n,transition:o,time:a}){this.addOrRemoveClasses(r,[],n,o,a,i)},exec_toggle_class(t,e,i,s,r,{to:n,names:o,transition:a,time:l}){this.toggleClasses(r,o,a,i)},exec_toggle_attr(t,e,i,s,r,{attr:[n,o,a]}){r.hasAttribute(n)?a!==void 0?r.getAttribute(n)===o?this.setOrRemoveAttrs(r,[[n,a]],[]):this.setOrRemoveAttrs(r,[[n,o]],[]):this.setOrRemoveAttrs(r,[],[n]):this.setOrRemoveAttrs(r,[[n,o]],[])},exec_transition(t,e,i,s,r,{time:n,transition:o}){this.addOrRemoveClasses(r,[],[],o,n,i)},exec_toggle(t,e,i,s,r,{display:n,ins:o,outs:a,time:l}){this.toggle(t,i,r,n,o,a,l)},exec_show(t,e,i,s,r,{display:n,transition:o,time:a}){this.show(t,i,r,n,o,a)},exec_hide(t,e,i,s,r,{display:n,transition:o,time:a}){this.hide(t,i,r,n,o,a)},exec_set_attr(t,e,i,s,r,{attr:[n,o]}){this.setOrRemoveAttrs(r,[[n,o]],[])},exec_remove_attr(t,e,i,s,r,{attr:n}){this.setOrRemoveAttrs(r,[],[n])},show(t,e,i,s,r,n){this.isVisible(i)||this.toggle(t,e,i,s,r,null,n)},hide(t,e,i,s,r,n){this.isVisible(i)&&this.toggle(t,e,i,s,null,r,n)},toggle(t,e,i,s,r,n,o){o=o||Hr;let[a,l,c]=r||[[],[],[]],[f,m,v]=n||[[],[],[]];if(a.length>0||f.length>0)if(this.isVisible(i)){let E=()=>{this.addOrRemoveClasses(i,m,a.concat(l).concat(c)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,f,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,v,m))})};i.dispatchEvent(new Event(`${$}:hide-start`)),e.transition(o,E,()=>{this.addOrRemoveClasses(i,[],f.concat(v)),p.putSticky(i,"toggle",b=>b.style.display="none"),i.dispatchEvent(new Event(`${$}:hide-end`))})}else{if(t==="remove")return;let E=()=>{this.addOrRemoveClasses(i,l,f.concat(m).concat(v));let b=s||this.defaultDisplay(i);p.putSticky(i,"toggle",w=>w.style.display=b),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(i,a,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(i,c,l))})};i.dispatchEvent(new Event(`${$}:show-start`)),e.transition(o,E,()=>{this.addOrRemoveClasses(i,[],a.concat(c)),i.dispatchEvent(new Event(`${$}:show-end`))})}else this.isVisible(i)?window.requestAnimationFrame(()=>{i.dispatchEvent(new Event(`${$}:hide-start`)),p.putSticky(i,"toggle",E=>E.style.display="none"),i.dispatchEvent(new Event(`${$}:hide-end`))}):window.requestAnimationFrame(()=>{i.dispatchEvent(new Event(`${$}:show-start`));let E=s||this.defaultDisplay(i);p.putSticky(i,"toggle",b=>b.style.display=E),i.dispatchEvent(new Event(`${$}:show-end`))})},toggleClasses(t,e,i,s,r){window.requestAnimationFrame(()=>{let[n,o]=p.getSticky(t,"classes",[[],[]]),a=e.filter(c=>n.indexOf(c)<0&&!t.classList.contains(c)),l=e.filter(c=>o.indexOf(c)<0&&t.classList.contains(c));this.addOrRemoveClasses(t,a,l,i,s,r)})},addOrRemoveClasses(t,e,i,s,r,n){r=r||Hr;let[o,a,l]=s||[[],[],[]];if(o.length>0){let c=()=>{this.addOrRemoveClasses(t,a,[].concat(o).concat(l)),window.requestAnimationFrame(()=>{this.addOrRemoveClasses(t,o,[]),window.requestAnimationFrame(()=>this.addOrRemoveClasses(t,l,a))})},f=()=>this.addOrRemoveClasses(t,e.concat(l),i.concat(o).concat(a));return n.transition(r,c,f)}window.requestAnimationFrame(()=>{let[c,f]=p.getSticky(t,"classes",[[],[]]),m=e.filter(w=>c.indexOf(w)<0&&!t.classList.contains(w)),v=i.filter(w=>f.indexOf(w)<0&&t.classList.contains(w)),E=c.filter(w=>i.indexOf(w)<0).concat(m),b=f.filter(w=>e.indexOf(w)<0).concat(v);p.putSticky(t,"classes",w=>(w.classList.remove(...b),w.classList.add(...E),[E,b]))})},setOrRemoveAttrs(t,e,i){let[s,r]=p.getSticky(t,"attrs",[[],[]]),n=e.map(([l,c])=>l).concat(i),o=s.filter(([l,c])=>!n.includes(l)).concat(e),a=r.filter(l=>!n.includes(l)).concat(i);p.putSticky(t,"attrs",l=>(a.forEach(c=>l.removeAttribute(c)),o.forEach(([c,f])=>l.setAttribute(c,f)),[o,a]))},hasAllClasses(t,e){return e.every(i=>t.classList.contains(i))},isToggledOut(t,e){return!this.isVisible(t)||this.hasAllClasses(t,e)},filterToEls(t,{to:e}){return e?p.all(document,e):[t]},defaultDisplay(t){return{tr:"table-row",td:"table-cell"}[t.tagName.toLowerCase()]||"block"}},ee=yo;var ye={byId(t){return document.getElementById(t)||ie(`no id found for ${t}`)},removeClass(t,e){t.classList.remove(e),t.classList.length===0&&t.removeAttribute("class")},all(t,e,i){if(!t)return[];let s=Array.from(t.querySelectorAll(e));return i?s.forEach(i):s},childNodeLength(t){let e=document.createElement("template");return e.innerHTML=t,e.content.childElementCount},isUploadInput(t){return t.type==="file"&&t.getAttribute(ge)!==null},isAutoUpload(t){return t.hasAttribute("data-phx-auto-upload")},findUploadInputs(t){let e=t.id,i=this.all(document,`input[type="file"][${ge}][form="${e}"]`);return this.all(t,`input[type="file"][${ge}]`).concat(i)},findComponentNodeList(t,e){return this.filterWithinSameLiveView(this.all(t,`[${me}="${e}"]`),t)},isPhxDestroyed(t){return!!(t.id&&ye.private(t,"destroyed"))},wantsNewTab(t){let e=t.ctrlKey||t.shiftKey||t.metaKey||t.button&&t.button===1,i=t.target instanceof HTMLAnchorElement&&t.target.hasAttribute("download"),s=t.target.hasAttribute("target")&&t.target.getAttribute("target").toLowerCase()==="_blank";return e||s||i},isUnloadableFormSubmit(t){return t.target&&t.target.getAttribute("method")==="dialog"||t.submitter&&t.submitter.getAttribute("formmethod")==="dialog"?!1:!t.defaultPrevented&&!this.wantsNewTab(t)},isNewPageClick(t,e){let i=t.target instanceof HTMLAnchorElement?t.target.getAttribute("href"):null,s;if(t.defaultPrevented||i===null||this.wantsNewTab(t)||i.startsWith("mailto:")||i.startsWith("tel:")||t.target.isContentEditable)return!1;try{s=new URL(i)}catch(r){try{s=new URL(i,e)}catch(n){return!0}}return s.host===e.host&&s.protocol===e.protocol&&s.pathname===e.pathname&&s.search===e.search?s.hash===""&&!s.href.endsWith("#"):s.protocol.startsWith("http")},markPhxChildDestroyed(t){this.isPhxChild(t)&&t.setAttribute(ve,""),this.putPrivate(t,"destroyed",!0)},findPhxChildrenInFragment(t,e){let i=document.createElement("template");return i.innerHTML=t,this.findPhxChildren(i.content,e)},isIgnored(t,e){return(t.getAttribute(e)||t.getAttribute("data-phx-update"))==="ignore"},isPhxUpdate(t,e,i){return t.getAttribute&&i.indexOf(t.getAttribute(e))>=0},findPhxSticky(t){return this.all(t,`[${cs}]`)},findPhxChildren(t,e){return this.all(t,`${He}[${ze}="${e}"]`)},findParentCIDs(t,e){let i=new Set(e),s=e.reduce((r,n)=>{let o=`[${me}="${n}"] [${me}]`;return this.filterWithinSameLiveView(this.all(t,o),t).map(a=>parseInt(a.getAttribute(me))).forEach(a=>r.delete(a)),r},i);return s.size===0?new Set(e):s},filterWithinSameLiveView(t,e){return e.querySelector(He)?t.filter(i=>this.withinSameLiveView(i,e)):t},withinSameLiveView(t,e){for(;t=t.parentNode;){if(t.isSameNode(e))return!0;if(t.getAttribute(ve)!==null)return!1}},private(t,e){return t[Ee]&&t[Ee][e]},deletePrivate(t,e){t[Ee]&&delete t[Ee][e]},putPrivate(t,e,i){t[Ee]||(t[Ee]={}),t[Ee][e]=i},updatePrivate(t,e,i,s){let r=this.private(t,e);r===void 0?this.putPrivate(t,e,s(i)):this.putPrivate(t,e,s(r))},copyPrivates(t,e){e[Ee]&&(t[Ee]=e[Ee])},putTitle(t){let e=document.querySelector("title");if(e){let{prefix:i,suffix:s}=e.dataset;document.title=`${i||""}${t}${s||""}`}else document.title=t},debounce(t,e,i,s,r,n,o,a){let l=t.getAttribute(i),c=t.getAttribute(r);l===""&&(l=s),c===""&&(c=n);let f=l||c;switch(f){case null:return a();case"blur":this.once(t,"debounce-blur")&&t.addEventListener("blur",()=>a());return;default:let m=parseInt(f),v=()=>c?this.deletePrivate(t,pt):a(),E=this.incCycle(t,ft,v);if(isNaN(m))return ie(`invalid throttle/debounce value: ${f}`);if(c){let w=!1;if(e.type==="keydown"){let N=this.private(t,fs);this.putPrivate(t,fs,e.key),w=N!==e.key}if(!w&&this.private(t,pt))return!1;{a();let N=setTimeout(()=>{o()&&this.triggerCycle(t,ft)},m);this.putPrivate(t,pt,N)}}else setTimeout(()=>{o()&&this.triggerCycle(t,ft,E)},m);let b=t.form;b&&this.once(b,"bind-debounce")&&b.addEventListener("submit",()=>{Array.from(new FormData(b).entries(),([w])=>{let N=b.querySelector(`[name="${w}"]`);this.incCycle(N,ft),this.deletePrivate(N,pt)})}),this.once(t,"bind-debounce")&&t.addEventListener("blur",()=>{clearTimeout(this.private(t,pt)),this.triggerCycle(t,ft)})}},triggerCycle(t,e,i){let[s,r]=this.private(t,e);i||(i=s),i===s&&(this.incCycle(t,e),r())},once(t,e){return this.private(t,e)===!0?!1:(this.putPrivate(t,e,!0),!0)},incCycle(t,e,i=function(){}){let[s]=this.private(t,e)||[0,i];return s++,this.putPrivate(t,e,[s,i]),s},isFeedbackContainer(t,e){return t.hasAttribute&&t.hasAttribute(e)},maybeHideFeedback(t,e,i,s){let r={};e.forEach(n=>{if(!t.contains(n))return;let o=n.getAttribute(i);if(!o){ee.addOrRemoveClasses(n,[],[Ct]);return}if(r[o]===!0){this.hideFeedback(n);return}r[o]=this.shouldHideFeedback(t,o,s),r[o]===!0&&this.hideFeedback(n)})},hideFeedback(t){ee.addOrRemoveClasses(t,[Ct],[])},shouldHideFeedback(t,e,i){let s=`[name="${e}"], [name="${e}[]"], [${i}="${e}"]`,r=!1;return ye.all(t,s,n=>{(this.private(n,Pt)||this.private(n,ct))&&(r=!0)}),!r},feedbackSelector(t,e,i){let s=`[${e}="${t.name}"], [${e}="${t.name.replace(/\[\]$/,"")}"]`;return t.getAttribute(i)&&(s+=`,[${e}="${t.getAttribute(i)}"]`),s},resetForm(t,e,i){Array.from(t.elements).forEach(s=>{let r=this.feedbackSelector(s,e,i);this.deletePrivate(s,Pt),this.deletePrivate(s,ct),this.all(document,r,n=>{ee.addOrRemoveClasses(n,[Ct],[])})})},showError(t,e,i){if(t.name){let s=this.feedbackSelector(t,e,i);this.all(document,s,r=>{ee.addOrRemoveClasses(r,[],[Ct])})}},isPhxChild(t){return t.getAttribute&&t.getAttribute(ze)},isPhxSticky(t){return t.getAttribute&&t.getAttribute(cs)!==null},isChildOfAny(t,e){return!!e.find(i=>i.contains(t))},firstPhxChild(t){return this.isPhxChild(t)?t:this.all(t,`[${ze}]`)[0]},dispatchEvent(t,e,i={}){let s=!0;t.nodeName==="INPUT"&&t.type==="file"&&e==="click"&&(s=!1);let o={bubbles:i.bubbles===void 0?s:!!i.bubbles,cancelable:!0,detail:i.detail||{}},a=e==="click"?new MouseEvent("click",o):new CustomEvent(e,o);t.dispatchEvent(a)},cloneNode(t,e){if(typeof e=="undefined")return t.cloneNode(!0);{let i=t.cloneNode(!1);return i.innerHTML=e,i}},mergeAttrs(t,e,i={}){let s=new Set(i.exclude||[]),r=i.isIgnored,n=e.attributes;for(let a=n.length-1;a>=0;a--){let l=n[a].name;if(s.has(l))l==="value"&&t.value===e.value&&t.setAttribute("value",e.getAttribute(l));else{let c=e.getAttribute(l);t.getAttribute(l)!==c&&(!r||r&&l.startsWith("data-"))&&t.setAttribute(l,c)}}let o=t.attributes;for(let a=o.length-1;a>=0;a--){let l=o[a].name;r?l.startsWith("data-")&&!e.hasAttribute(l)&&![oe,Pe].includes(l)&&t.removeAttribute(l):e.hasAttribute(l)||t.removeAttribute(l)}},mergeFocusedInput(t,e){t instanceof HTMLSelectElement||ye.mergeAttrs(t,e,{exclude:["value"]}),e.readOnly?t.setAttribute("readonly",!0):t.removeAttribute("readonly")},hasSelectionRange(t){return t.setSelectionRange&&(t.type==="text"||t.type==="textarea")},restoreFocus(t,e,i){if(t instanceof HTMLSelectElement&&t.focus(),!ye.isTextualInput(t))return;let s=t.matches(":focus");t.readOnly&&t.blur(),s||t.focus(),this.hasSelectionRange(t)&&t.setSelectionRange(e,i)},isFormInput(t){return/^(?:input|select|textarea)$/i.test(t.tagName)&&t.type!=="button"},syncAttrsToProps(t){t instanceof HTMLInputElement&&oi.indexOf(t.type.toLocaleLowerCase())>=0&&(t.checked=t.getAttribute("checked")!==null)},isTextualInput(t){return br.indexOf(t.type)>=0},isNowTriggerFormExternal(t,e){return t.getAttribute&&t.getAttribute(e)!==null},syncPendingRef(t,e,i){let s=t.getAttribute(oe);if(s===null)return!0;let r=t.getAttribute(Pe);return ye.isFormInput(t)||t.getAttribute(i)!==null?(ye.isUploadInput(t)&&ye.mergeAttrs(t,e,{isIgnored:!0}),ye.putPrivate(t,oe,e),!1):(Qt.forEach(n=>{t.classList.contains(n)&&e.classList.add(n)}),e.setAttribute(oe,s),e.setAttribute(Pe,r),!0)},cleanChildNodes(t,e){if(ye.isPhxUpdate(t,e,["append","prepend"])){let i=[];t.childNodes.forEach(s=>{s.id||(!(s.nodeType===Node.TEXT_NODE&&s.nodeValue.trim()==="")&&s.nodeType!==s.COMMENT_NODE&&ie(`only HTML element tags with an id are allowed inside containers with phx-update. removing illegal node: "${(s.outerHTML||s.nodeValue).trim()}" `),i.push(s))}),i.forEach(s=>s.remove())}},replaceRootContainer(t,e,i){let s=new Set(["id",ve,$e,si,Re]);if(t.tagName.toLowerCase()===e.toLowerCase())return Array.from(t.attributes).filter(r=>!s.has(r.name.toLowerCase())).forEach(r=>t.removeAttribute(r.name)),Object.keys(i).filter(r=>!s.has(r.toLowerCase())).forEach(r=>t.setAttribute(r,i[r])),t;{let r=document.createElement(e);return Object.keys(i).forEach(n=>r.setAttribute(n,i[n])),s.forEach(n=>r.setAttribute(n,t.getAttribute(n))),r.innerHTML=t.innerHTML,t.replaceWith(r),r}},getSticky(t,e,i){let s=(ye.private(t,"sticky")||[]).find(([r])=>e===r);if(s){let[r,n,o]=s;return o}else return typeof i=="function"?i():i},deleteSticky(t,e){this.updatePrivate(t,"sticky",[],i=>i.filter(([s,r])=>s!==e))},putSticky(t,e,i){let s=i(t);this.updatePrivate(t,"sticky",[],r=>{let n=r.findIndex(([o])=>e===o);return n>=0?r[n]=[e,i,s]:r.push([e,i,s]),r})},applyStickyOperations(t){let e=ye.private(t,"sticky");!e||e.forEach(([i,s,r])=>this.putSticky(t,i,s))}},p=ye;var Le=class{static isActive(e,i){let s=i._phxRef===void 0,r=Le.isPreflightInProgress(i),o=e.getAttribute(xt).split(",").indexOf(X.genFileRef(i))>=0;return i.size>0&&(s||o||!r)}static isPreflighted(e,i){return e.getAttribute(at).split(",").indexOf(X.genFileRef(i))>=0&&this.isActive(e,i)}static isPreflightInProgress(e){return e._preflightInProgress===!0}static markPreflightInProgress(e){e._preflightInProgress=!0}constructor(e,i,s){this.ref=X.genFileRef(i),this.fileEl=e,this.file=i,this.view=s,this.meta=null,this._isCancelled=!1,this._isDone=!1,this._progress=0,this._lastProgressSent=-1,this._onDone=function(){},this._onElUpdated=this.onElUpdated.bind(this),this.fileEl.addEventListener(lt,this._onElUpdated)}metadata(){return this.meta}progress(e){this._progress=Math.floor(e),this._progress>this._lastProgressSent&&(this._progress>=100?(this._progress=100,this._lastProgressSent=100,this._isDone=!0,this.view.pushFileProgress(this.fileEl,this.ref,100,()=>{X.untrackFile(this.fileEl,this.file),this._onDone()})):(this._lastProgressSent=this._progress,this.view.pushFileProgress(this.fileEl,this.ref,this._progress)))}cancel(){this._isCancelled=!0,this._isDone=!0,this._onDone()}isDone(){return this._isDone}error(e="failed"){this.fileEl.removeEventListener(lt,this._onElUpdated),this.view.pushFileProgress(this.fileEl,this.ref,{error:e}),p.isAutoUpload(this.fileEl)||X.clearFiles(this.fileEl)}onDone(e){this._onDone=()=>{this.fileEl.removeEventListener(lt,this._onElUpdated),e()}}onElUpdated(){this.fileEl.getAttribute(xt).split(",").indexOf(this.ref)===-1&&this.cancel()}toPreflightPayload(){return{last_modified:this.file.lastModified,name:this.file.name,relative_path:this.file.webkitRelativePath,size:this.file.size,type:this.file.type,ref:this.ref,meta:typeof this.file.meta=="function"?this.file.meta():void 0}}uploader(e){if(this.meta.uploader){let i=e[this.meta.uploader]||ie(`no uploader configured for ${this.meta.uploader}`);return{name:this.meta.uploader,callback:i}}else return{name:"channel",callback:Dr}}zipPostFlight(e){this.meta=e.entries[this.ref],this.meta||ie(`no preflight upload response returned with ref ${this.ref}`,{input:this.fileEl,response:e})}};var So=0,X=class{static genFileRef(e){let i=e._phxRef;return i!==void 0?i:(e._phxRef=(So++).toString(),e._phxRef)}static getEntryDataURL(e,i,s){let r=this.activeFiles(e).find(n=>this.genFileRef(n)===i);s(URL.createObjectURL(r))}static hasUploadsInProgress(e){let i=0;return p.findUploadInputs(e).forEach(s=>{s.getAttribute(at)!==s.getAttribute(_r)&&i++}),i>0}static serializeUploads(e){let i=this.activeFiles(e),s={};return i.forEach(r=>{let n={path:e.name},o=e.getAttribute(ge);s[o]=s[o]||[],n.ref=this.genFileRef(r),n.last_modified=r.lastModified,n.name=r.name||n.ref,n.relative_path=r.webkitRelativePath,n.type=r.type,n.size=r.size,typeof r.meta=="function"&&(n.meta=r.meta()),s[o].push(n)}),s}static clearFiles(e){e.value=null,e.removeAttribute(ge),p.putPrivate(e,"files",[])}static untrackFile(e,i){p.putPrivate(e,"files",p.private(e,"files").filter(s=>!Object.is(s,i)))}static trackFiles(e,i,s){if(e.getAttribute("multiple")!==null){let r=i.filter(n=>!this.activeFiles(e).find(o=>Object.is(o,n)));p.putPrivate(e,"files",this.activeFiles(e).concat(r)),e.value=null}else s&&s.files.length>0&&(e.files=s.files),p.putPrivate(e,"files",i)}static activeFileInputs(e){let i=p.findUploadInputs(e);return Array.from(i).filter(s=>s.files&&this.activeFiles(s).length>0)}static activeFiles(e){return(p.private(e,"files")||[]).filter(i=>Le.isActive(e,i))}static inputsAwaitingPreflight(e){let i=p.findUploadInputs(e);return Array.from(i).filter(s=>this.filesAwaitingPreflight(s).length>0)}static filesAwaitingPreflight(e){return this.activeFiles(e).filter(i=>!Le.isPreflighted(e,i)&&!Le.isPreflightInProgress(i))}static markPreflightInProgress(e){e.forEach(i=>Le.markPreflightInProgress(i.file))}constructor(e,i,s){this.view=i,this.onComplete=s,this._entries=Array.from(X.filesAwaitingPreflight(e)||[]).map(r=>new Le(e,r,i)),X.markPreflightInProgress(this._entries),this.numEntriesInProgress=this._entries.length}entries(){return this._entries}initAdapterUpload(e,i,s){this._entries=this._entries.map(n=>(n.zipPostFlight(e),n.onDone(()=>{this.numEntriesInProgress--,this.numEntriesInProgress===0&&this.onComplete()}),n));let r=this._entries.reduce((n,o)=>{if(!o.meta)return n;let{name:a,callback:l}=o.uploader(s.uploaders);return n[a]=n[a]||{callback:l,entries:[]},n[a].entries.push(o),n},{});for(let n in r){let{callback:o,entries:a}=r[n];o(a,i,e,s)}}};var Eo={LiveFileUpload:{activeRefs(){return this.el.getAttribute(xt)},preflightedRefs(){return this.el.getAttribute(at)},mounted(){this.preflightedWas=this.preflightedRefs()},updated(){let t=this.preflightedRefs();this.preflightedWas!==t&&(this.preflightedWas=t,t===""&&this.__view.cancelSubmit(this.el.form)),this.activeRefs()===""&&(this.el.value=null),this.el.dispatchEvent(new CustomEvent(lt))}},LiveImgPreview:{mounted(){this.ref=this.el.getAttribute("data-phx-entry-ref"),this.inputEl=document.getElementById(this.el.getAttribute(ge)),X.getEntryDataURL(this.inputEl,this.ref,t=>{this.url=t,this.el.src=t})},destroyed(){URL.revokeObjectURL(this.url)}},FocusWrap:{mounted(){this.focusStart=this.el.firstElementChild,this.focusEnd=this.el.lastElementChild,this.focusStart.addEventListener("focus",()=>Ue.focusLast(this.el)),this.focusEnd.addEventListener("focus",()=>Ue.focusFirst(this.el)),this.el.addEventListener(`${$}:show-end`,()=>this.el.focus()),window.getComputedStyle(this.el).display!=="none"&&Ue.focusFirst(this.el)}}},Mr=Eo;var gi=class{constructor(e,i,s){let r=new Set,n=new Set([...i.children].map(a=>a.id)),o=[];Array.from(e.children).forEach(a=>{if(a.id&&(r.add(a.id),n.has(a.id))){let l=a.previousElementSibling&&a.previousElementSibling.id;o.push({elementId:a.id,previousElementId:l})}}),this.containerId=i.id,this.updateType=s,this.elementsToModify=o,this.elementIdsToAdd=[...n].filter(a=>!r.has(a))}perform(){let e=p.byId(this.containerId);this.elementsToModify.forEach(i=>{i.previousElementId?Ae(document.getElementById(i.previousElementId),s=>{Ae(document.getElementById(i.elementId),r=>{r.previousElementSibling&&r.previousElementSibling.id==s.id||s.insertAdjacentElement("afterend",r)})}):Ae(document.getElementById(i.elementId),s=>{s.previousElementSibling==null||e.insertAdjacentElement("afterbegin",s)})}),this.updateType=="prepend"&&this.elementIdsToAdd.reverse().forEach(i=>{Ae(document.getElementById(i),s=>e.insertAdjacentElement("afterbegin",s))})}};var Nr=11;function wo(t,e){var i=e.attributes,s,r,n,o,a;if(!(e.nodeType===Nr||t.nodeType===Nr)){for(var l=i.length-1;l>=0;l--)s=i[l],r=s.name,n=s.namespaceURI,o=s.value,n?(r=s.localName||r,a=t.getAttributeNS(n,r),a!==o&&(s.prefix==="xmlns"&&(r=s.name),t.setAttributeNS(n,r,o))):(a=t.getAttribute(r),a!==o&&t.setAttribute(r,o));for(var c=t.attributes,f=c.length-1;f>=0;f--)s=c[f],r=s.name,n=s.namespaceURI,n?(r=s.localName||r,e.hasAttributeNS(n,r)||t.removeAttributeNS(n,r)):e.hasAttribute(r)||t.removeAttribute(r)}}var _i,Ao="http://www.w3.org/1999/xhtml",ce=typeof document=="undefined"?void 0:document,To=!!ce&&"content"in ce.createElement("template"),xo=!!ce&&ce.createRange&&"createContextualFragment"in ce.createRange();function Co(t){var e=ce.createElement("template");return e.innerHTML=t,e.content.childNodes[0]}function ko(t){_i||(_i=ce.createRange(),_i.selectNode(ce.body));var e=_i.createContextualFragment(t);return e.childNodes[0]}function Po(t){var e=ce.createElement("body");return e.innerHTML=t,e.childNodes[0]}function Ro(t){return t=t.trim(),To?Co(t):xo?ko(t):Po(t)}function vi(t,e){var i=t.nodeName,s=e.nodeName,r,n;return i===s?!0:(r=i.charCodeAt(0),n=s.charCodeAt(0),r<=90&&n>=97?i===s.toUpperCase():n<=90&&r>=97?s===i.toUpperCase():!1)}function Io(t,e){return!e||e===Ao?ce.createElement(t):ce.createElementNS(e,t)}function Lo(t,e){for(var i=t.firstChild;i;){var s=i.nextSibling;e.appendChild(i),i=s}return e}function bs(t,e,i){t[i]!==e[i]&&(t[i]=e[i],t[i]?t.setAttribute(i,""):t.removeAttribute(i))}var Fr={OPTION:function(t,e){var i=t.parentNode;if(i){var s=i.nodeName.toUpperCase();s==="OPTGROUP"&&(i=i.parentNode,s=i&&i.nodeName.toUpperCase()),s==="SELECT"&&!i.hasAttribute("multiple")&&(t.hasAttribute("selected")&&!e.selected&&(t.setAttribute("selected","selected"),t.removeAttribute("selected")),i.selectedIndex=-1)}bs(t,e,"selected")},INPUT:function(t,e){bs(t,e,"checked"),bs(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),e.hasAttribute("value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var i=e.value;t.value!==i&&(t.value=i);var s=t.firstChild;if(s){var r=s.nodeValue;if(r==i||!i&&r==t.placeholder)return;s.nodeValue=i}},SELECT:function(t,e){if(!e.hasAttribute("multiple")){for(var i=-1,s=0,r=t.firstChild,n,o;r;)if(o=r.nodeName&&r.nodeName.toUpperCase(),o==="OPTGROUP")n=r,r=n.firstChild;else{if(o==="OPTION"){if(r.hasAttribute("selected")){i=s;break}s++}r=r.nextSibling,!r&&n&&(r=n.nextSibling,n=null)}t.selectedIndex=i}}},Ot=1,$r=11,Ur=3,Br=8;function Be(){}function Do(t){if(t)return t.getAttribute&&t.getAttribute("id")||t.id}function Oo(t){return function(i,s,r){if(r||(r={}),typeof s=="string")if(i.nodeName==="#document"||i.nodeName==="HTML"||i.nodeName==="BODY"){var n=s;s=ce.createElement("html"),s.innerHTML=n}else s=Ro(s);else s.nodeType===$r&&(s=s.firstElementChild);var o=r.getNodeKey||Do,a=r.onBeforeNodeAdded||Be,l=r.onNodeAdded||Be,c=r.onBeforeElUpdated||Be,f=r.onElUpdated||Be,m=r.onBeforeNodeDiscarded||Be,v=r.onNodeDiscarded||Be,E=r.onBeforeElChildrenUpdated||Be,b=r.skipFromChildren||Be,w=r.addChild||function(C,x){return C.appendChild(x)},N=r.childrenOnly===!0,L=Object.create(null),I=[];function B(C){I.push(C)}function q(C,x){if(C.nodeType===Ot)for(var J=C.firstChild;J;){var R=void 0;x&&(R=o(J))?B(R):(v(J),J.firstChild&&q(J,x)),J=J.nextSibling}}function Z(C,x,J){m(C)!==!1&&(x&&x.removeChild(C),v(C),q(C,J))}function W(C){if(C.nodeType===Ot||C.nodeType===$r)for(var x=C.firstChild;x;){var J=o(x);J&&(L[J]=x),W(x),x=x.nextSibling}}W(i);function V(C){l(C);for(var x=C.firstChild;x;){var J=x.nextSibling,R=o(x);if(R){var U=L[R];U&&vi(x,U)?(x.parentNode.replaceChild(U,x),g(U,x)):V(x)}else V(x);x=J}}function _e(C,x,J){for(;x;){var R=x.nextSibling;(J=o(x))?B(J):Z(x,C,!0),x=R}}function g(C,x,J){var R=o(x);R&&delete L[R],!(!J&&(c(C,x)===!1||(t(C,x),f(C),E(C,x)===!1)))&&(C.nodeName!=="TEXTAREA"?k(C,x):Fr.TEXTAREA(C,x))}function k(C,x){var J=b(C,x),R=x.firstChild,U=C.firstChild,Fe,fe,xe,qe,re;e:for(;R;){for(qe=R.nextSibling,Fe=o(R);!J&&U;){if(xe=U.nextSibling,R.isSameNode&&R.isSameNode(U)){R=qe,U=xe;continue e}fe=o(U);var ot=U.nodeType,Se=void 0;if(ot===R.nodeType&&(ot===Ot?(Fe?Fe!==fe&&((re=L[Fe])?xe===re?Se=!1:(C.insertBefore(re,U),fe?B(fe):Z(U,C,!0),U=re,fe=o(U)):Se=!1):fe&&(Se=!1),Se=Se!==!1&&vi(U,R),Se&&g(U,R)):(ot===Ur||ot==Br)&&(Se=!0,U.nodeValue!==R.nodeValue&&(U.nodeValue=R.nodeValue))),Se){R=qe,U=xe;continue e}fe?B(fe):Z(U,C,!0),U=xe}if(Fe&&(re=L[Fe])&&vi(re,R))J||w(C,re),g(re,R);else{var St=a(R);St!==!1&&(St&&(R=St),R.actualize&&(R=R.actualize(C.ownerDocument||ce)),w(C,R),V(R))}R=qe,U=xe}_e(C,U,fe);var jt=Fr[C.nodeName];jt&&jt(C,x)}var D=i,Y=D.nodeType,ue=s.nodeType;if(!N){if(Y===Ot)ue===Ot?vi(i,s)||(v(i),D=Lo(i,Io(s.nodeName,s.namespaceURI))):D=s;else if(Y===Ur||Y===Br){if(ue===Y)return D.nodeValue!==s.nodeValue&&(D.nodeValue=s.nodeValue),D;D=s}}if(D===s)v(i);else{if(s.isSameNode&&s.isSameNode(D))return;if(g(D,s,N),I)for(var yt=0,Xi=I.length;yt{if(s&&s.isSameNode(r)&&p.isFormInput(r))return p.mergeFocusedInput(r,n),!1}})}constructor(e,i,s,r,n,o){this.view=e,this.liveSocket=e.liveSocket,this.container=i,this.id=s,this.rootID=e.root.id,this.html=r,this.streams=n,this.streamInserts={},this.streamComponentRestore={},this.targetCID=o,this.cidPatch=be(this.targetCID),this.pendingRemoves=[],this.phxRemove=this.liveSocket.binding("remove"),this.callbacks={beforeadded:[],beforeupdated:[],beforephxChildAdded:[],afteradded:[],afterupdated:[],afterdiscarded:[],afterphxChildAdded:[],aftertransitionsDiscarded:[]}}before(e,i){this.callbacks[`before${e}`].push(i)}after(e,i){this.callbacks[`after${e}`].push(i)}trackBefore(e,...i){this.callbacks[`before${e}`].forEach(s=>s(...i))}trackAfter(e,...i){this.callbacks[`after${e}`].forEach(s=>s(...i))}markPrunableContentForRemoval(){let e=this.liveSocket.binding(ut);p.all(this.container,`[${e}=append] > *, [${e}=prepend] > *`,i=>{i.setAttribute(os,"")})}perform(e){let{view:i,liveSocket:s,container:r,html:n}=this,o=this.isCIDPatch()?this.targetCIDContainer(n):r;if(this.isCIDPatch()&&!o)return;let a=s.getActiveElement(),{selectionStart:l,selectionEnd:c}=a&&p.hasSelectionRange(a)?a:{},f=s.binding(ut),m=s.binding(Ge),v=s.binding(Ye),E=s.binding(Rt),b=s.binding(ri),w=s.binding(ni),N=s.binding(vr),L=[],I=[],B=[],q=[],Z=null;function W(V,_e){ys(V,_e,{childrenOnly:V.getAttribute(me)===null,getNodeKey:g=>p.isPhxDestroyed(g)?null:e?g.id:g.id||g.getAttribute&&g.getAttribute(ti),skipFromChildren:g=>g.getAttribute(f)===li,addChild:(g,k)=>{let{ref:D,streamAt:Y}=this.getStreamInsert(k);if(D===void 0)return g.appendChild(k);if(this.setStreamRef(k,D),Y===0)g.insertAdjacentElement("afterbegin",k);else if(Y===-1)g.appendChild(k);else if(Y>0){let ue=Array.from(g.children)[Y];g.insertBefore(k,ue)}},onBeforeNodeAdded:g=>{this.trackBefore("added",g);let k=g;return!e&&this.streamComponentRestore[g.id]&&(k=this.streamComponentRestore[g.id],delete this.streamComponentRestore[g.id],W.bind(this)(k,g)),k},onNodeAdded:g=>{g.getAttribute&&this.maybeReOrderStream(g,!0),p.isFeedbackContainer(g,m)&&I.push(g),g instanceof HTMLImageElement&&g.srcset?g.srcset=g.srcset:g instanceof HTMLVideoElement&&g.autoplay&&g.play(),p.isNowTriggerFormExternal(g,N)&&(Z=g),(p.isPhxChild(g)&&i.ownsElement(g)||p.isPhxSticky(g)&&i.ownsElement(g.parentNode))&&this.trackAfter("phxChildAdded",g),L.push(g)},onNodeDiscarded:g=>this.onNodeDiscarded(g),onBeforeNodeDiscarded:g=>g.getAttribute&&g.getAttribute(os)!==null?!0:!(g.parentElement!==null&&g.id&&p.isPhxUpdate(g.parentElement,f,[li,"append","prepend"])||this.maybePendingRemove(g)||this.skipCIDSibling(g)),onElUpdated:g=>{p.isNowTriggerFormExternal(g,N)&&(Z=g),B.push(g),this.maybeReOrderStream(g,!1)},onBeforeElUpdated:(g,k)=>{if((p.isFeedbackContainer(g,m)||p.isFeedbackContainer(k,m))&&(I.push(g),I.push(k)),p.cleanChildNodes(k,f),this.skipCIDSibling(k))return this.maybeReOrderStream(g),!1;if(p.isPhxSticky(g))return!1;if(p.isIgnored(g,f)||g.form&&g.form.isSameNode(Z))return this.trackBefore("updated",g,k),p.mergeAttrs(g,k,{isIgnored:!0}),B.push(g),p.applyStickyOperations(g),!1;if(g.type==="number"&&g.validity&&g.validity.badInput)return!1;if(!p.syncPendingRef(g,k,E))return p.isUploadInput(g)&&(this.trackBefore("updated",g,k),B.push(g)),p.applyStickyOperations(g),!1;if(p.isPhxChild(k)){let ue=g.getAttribute(ve);return p.mergeAttrs(g,k,{exclude:[$e]}),ue!==""&&g.setAttribute(ve,ue),g.setAttribute(Re,this.rootID),p.applyStickyOperations(g),!1}p.copyPrivates(k,g);let D=a&&g.isSameNode(a)&&p.isFormInput(g),Y=D&&this.isChangedSelect(g,k);return D&&g.type!=="hidden"&&!Y?(this.trackBefore("updated",g,k),p.mergeFocusedInput(g,k),p.syncAttrsToProps(g),B.push(g),p.applyStickyOperations(g),!1):(Y&&g.blur(),p.isPhxUpdate(k,f,["append","prepend"])&&q.push(new gi(g,k,k.getAttribute(f))),p.syncAttrsToProps(k),p.applyStickyOperations(k),this.trackBefore("updated",g,k),!0)}})}return this.trackBefore("added",r),this.trackBefore("updated",r,r),s.time("morphdom",()=>{this.streams.forEach(([V,_e,g,k])=>{_e.forEach(([D,Y,ue])=>{this.streamInserts[D]={ref:V,streamAt:Y,limit:ue,reset:k}}),k!==void 0&&p.all(r,`[${hi}="${V}"]`,D=>{this.removeStreamChildElement(D)}),g.forEach(D=>{let Y=r.querySelector(`[id="${D}"]`);Y&&this.removeStreamChildElement(Y)})}),e&&p.all(this.container,`[${f}=${li}]`,V=>{this.liveSocket.owner(V,_e=>{_e===this.view&&Array.from(V.children).forEach(g=>{this.removeStreamChildElement(g)})})}),W.bind(this)(o,n)}),s.isDebugEnabled()&&Rr(s.doofinderMount),q.length>0&&s.time("post-morph append/prepend restoration",()=>{q.forEach(V=>V.perform())}),p.maybeHideFeedback(o,I,m,v),s.silenceEvents(()=>p.restoreFocus(a,l,c)),p.dispatchEvent(document,`${$}:update`),L.forEach(V=>this.trackAfter("added",V)),B.forEach(V=>this.trackAfter("updated",V)),this.transitionPendingRemoves(),Z&&(s.unload(),Object.getPrototypeOf(Z).submit.call(Z)),!0}onNodeDiscarded(e){(p.isPhxChild(e)||p.isPhxSticky(e))&&this.liveSocket.destroyViewByEl(e),this.trackAfter("discarded",e)}maybePendingRemove(e){return e.getAttribute&&e.getAttribute(this.phxRemove)!==null?(this.pendingRemoves.push(e),!0):!1}removeStreamChildElement(e){this.streamInserts[e.id]?(this.streamComponentRestore[e.id]=e,e.remove()):this.maybePendingRemove(e)||(e.remove(),this.onNodeDiscarded(e))}getStreamInsert(e){return(e.id?this.streamInserts[e.id]:{})||{}}setStreamRef(e,i){p.putSticky(e,hi,s=>s.setAttribute(hi,i))}maybeReOrderStream(e,i){let{ref:s,streamAt:r,reset:n}=this.getStreamInsert(e);if(r!==void 0&&(this.setStreamRef(e,s),!(!n&&!i)&&!!e.parentElement)){if(r===0)e.parentElement.insertBefore(e,e.parentElement.firstElementChild);else if(r>0){let o=Array.from(e.parentElement.children),a=o.indexOf(e);if(r>=o.length-1)e.parentElement.appendChild(e);else{let l=o[r];a>r?e.parentElement.insertBefore(e,l):e.parentElement.insertBefore(e,l.nextElementSibling)}}this.maybeLimitStream(e)}}maybeLimitStream(e){let{limit:i}=this.getStreamInsert(e),s=i!==null&&Array.from(e.parentElement.children);i&&i<0&&s.length>i*-1?s.slice(0,s.length+i).forEach(r=>this.removeStreamChildElement(r)):i&&i>=0&&s.length>i&&s.slice(i).forEach(r=>this.removeStreamChildElement(r))}transitionPendingRemoves(){let{pendingRemoves:e,liveSocket:i}=this;e.length>0&&(i.transitionRemoves(e),i.requestDOMUpdate(()=>{e.forEach(s=>{let r=p.firstPhxChild(s);r&&i.destroyViewByEl(r),s.remove()}),this.trackAfter("transitionsDiscarded",e)}))}isChangedSelect(e,i){if(!(e instanceof HTMLSelectElement)||e.multiple)return!1;if(e.options.length!==i.options.length)return!0;let s=e.selectedOptions[0],r=i.selectedOptions[0];return s&&s.hasAttribute("selected")&&r.setAttribute("selected",s.getAttribute("selected")),!e.isEqualNode(i)}isCIDPatch(){return this.cidPatch}skipCIDSibling(e){return e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute(ei)}targetCIDContainer(e){if(!this.isCIDPatch())return;let[i,...s]=p.findComponentNodeList(this.container,this.targetCID);return s.length===0&&p.childNodeLength(e)===1?i:i&&i.parentNode}indexOf(e,i){return Array.from(e.children).indexOf(i)}};var Mo=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),No=new Set(["'",'"']),Vr=(t,e,i)=>{let s=0,r=!1,n,o,a,l,c,f,m=t.match(/^(\s*(?:\s*)*)<([^\s\/>]+)/);if(m===null)throw new Error(`malformed html ${t}`);for(s=m[0].length,n=m[1],a=m[2],l=s,s;s";s++)if(t.charAt(s)==="="){let b=t.slice(s-3,s)===" id";s++;let w=t.charAt(s);if(No.has(w)){let N=s;for(s++,s;s=n.length+a.length;){let b=t.charAt(v);if(r)b==="-"&&t.slice(v-3,v)===""&&t.slice(v-2,v)==="--")r=!0,v-=3;else{if(b===">")break;v-=1}}o=t.slice(v+1,t.length);let E=Object.keys(e).map(b=>e[b]===!0?b:`${b}="${e[b]}"`).join(" ");if(i){let b=c?` id="${c}"`:"";Mo.has(a)?f=`<${a}${b}${E===""?"":" "}${E}/>`:f=`<${a}${b}${E===""?"":" "}${E}>`}else{let b=t.slice(l,v+1);f=`<${a}${E===""?"":" "}${E}${b}`}return[f,n,o]},Ht=class{static extract(e){let{[ms]:i,[ps]:s,[gs]:r}=e;return delete e[ms],delete e[ps],delete e[gs],{diff:e,title:r,reply:i||null,events:s||[]}}constructor(e,i){this.viewId=e,this.rendered={},this.magicId=0,this.mergeDiff(i)}parentViewId(){return this.viewId}toString(e){let[i,s]=this.recursiveToString(this.rendered,this.rendered[ae],e,!0,{});return[i,s]}recursiveToString(e,i=e[ae],s,r,n){s=s?new Set(s):null;let o={buffer:"",components:i,onlyCids:s,streams:new Set};return this.toOutputBuffer(e,null,o,r,n),[o.buffer,o.streams]}componentCIDs(e){return Object.keys(e[ae]||{}).map(i=>parseInt(i))}isComponentOnlyDiff(e){return e[ae]?Object.keys(e).length===1:!1}getComponent(e,i){return e[ae][i]}resetRender(e){this.rendered[ae][e]&&(this.rendered[ae][e].reset=!0)}mergeDiff(e){let i=e[ae],s={};if(delete e[ae],this.rendered=this.mutableMerge(this.rendered,e),this.rendered[ae]=this.rendered[ae]||{},i){let r=this.rendered[ae];for(let n in i)i[n]=this.cachedFindComponent(n,i[n],r,i,s);for(let n in i)r[n]=i[n];e[ae]=i}}cachedFindComponent(e,i,s,r,n){if(n[e])return n[e];{let o,a,l=i[we];if(be(l)){let c;l>0?c=this.cachedFindComponent(l,r[l],s,r,n):c=s[-l],a=c[we],o=this.cloneMerge(c,i,!0),o[we]=a}else o=i[we]!==void 0||s[e]===void 0?i:this.cloneMerge(s[e],i,!1);return n[e]=o,o}}mutableMerge(e,i){return i[we]!==void 0?i:(this.doMutableMerge(e,i),e)}doMutableMerge(e,i){for(let s in i){let r=i[s],n=e[s];Ze(r)&&r[we]===void 0&&Ze(n)?this.doMutableMerge(n,r):e[s]=r}e[ui]&&(e.newRender=!0)}cloneMerge(e,i,s){let r=O(O({},e),i);for(let n in r){let o=i[n],a=e[n];Ze(o)&&o[we]===void 0&&Ze(a)?r[n]=this.cloneMerge(a,o,s):o===void 0&&Ze(a)&&(r[n]=this.cloneMerge(a,{},s))}return s?(delete r.magicId,delete r.newRender):e[ui]&&(r.newRender=!0),r}componentToString(e){let[i,s]=this.recursiveCIDToString(this.rendered[ae],e,null),[r,n,o]=Vr(i,{});return[r,s]}pruneCIDs(e){e.forEach(i=>delete this.rendered[ae][i])}get(){return this.rendered}isNewFingerprint(e={}){return!!e[we]}templateStatic(e,i){return typeof e=="number"?i[e]:e}nextMagicID(){return this.magicId++,`m${this.magicId}-${this.parentViewId()}`}toOutputBuffer(e,i,s,r,n={}){if(e[Dt])return this.comprehensionToBuffer(e,i,s);let{[we]:o}=e;o=this.templateStatic(o,i);let a=e[ui],l=s.buffer;a&&(s.buffer=""),r&&a&&!e.magicId&&(e.newRender=!0,e.magicId=this.nextMagicID()),s.buffer+=o[0];for(let c=1;c0||c.length>0||f)&&(delete e[_s],e[Dt]=[],s.streams.add(o))}dynamicToBuffer(e,i,s,r){if(typeof e=="number"){let[n,o]=this.recursiveCIDToString(s.components,e,s.onlyCids);s.buffer+=n,s.streams=new Set([...s.streams,...o])}else Ze(e)?this.toOutputBuffer(e,i,s,r,{}):s.buffer+=e}recursiveCIDToString(e,i,s){let r=e[i]||ie(`no component for CID ${i}`,e),n={[me]:i},o=s&&!s.has(i);r.newRender=!o,r.magicId=`c${i}-${this.parentViewId()}`;let a=!r.reset,[l,c]=this.recursiveToString(r,e,s,a,n);return delete r.reset,[l,c]}};var Fo=1,Ve=class{static makeID(){return Fo++}static elementID(e){return e.phxHookId}constructor(e,i,s){this.__view=e,this.liveSocket=e.liveSocket,this.__callbacks=s,this.__listeners=new Set,this.__isDisconnected=!1,this.el=i,this.el.phxHookId=this.constructor.makeID();for(let r in this.__callbacks)this[r]=this.__callbacks[r]}__mounted(){this.mounted&&this.mounted()}__updated(){this.updated&&this.updated()}__beforeUpdate(){this.beforeUpdate&&this.beforeUpdate()}__destroyed(){this.destroyed&&this.destroyed()}__reconnected(){this.__isDisconnected&&(this.__isDisconnected=!1,this.reconnected&&this.reconnected())}__disconnected(){this.__isDisconnected=!0,this.disconnected&&this.disconnected()}pushEvent(e,i={},s=function(){}){return this.__view.pushHookEvent(this.el,null,e,i,s)}pushEventTo(e,i,s={},r=function(){}){return this.__view.withinTargets(e,(n,o)=>n.pushHookEvent(this.el,o,i,s,r))}handleEvent(e,i){let s=(r,n)=>n?e:i(r.detail);return this.liveSocket.doofinderMount.addEventListener(`${$}:${e}`,s),this.__listeners.add(s),s}removeHandleEvent(e){let i=e(null,!0);this.liveSocket.doofinderMount.removeEventListener(`${$}:${i}`,e),this.__listeners.delete(e)}upload(e,i){return this.__view.dispatchUploads(null,e,i)}uploadTo(e,i,s){return this.__view.withinTargets(e,(r,n)=>{r.dispatchUploads(n,i,s)})}__cleanup__(){this.__listeners.forEach(e=>this.removeHandleEvent(e))}};var bi=(t,e,i=[])=>{let c=e,{submitter:s}=c,r=nr(c,["submitter"]),n;if(s&&s.name){let f=document.createElement("input");f.type="hidden";let m=s.getAttribute("form");m&&f.setAttribute("form",m),f.name=s.name,f.value=s.value,s.parentElement.insertBefore(f,s),n=f}let o=new FormData(t),a=[];o.forEach((f,m,v)=>{f instanceof File&&a.push(m)}),a.forEach(f=>o.delete(f));let l=new URLSearchParams;for(let[f,m]of o.entries())(i.length===0||i.indexOf(f)>=0)&&l.append(f,m);s&&n&&s.parentElement.removeChild(n);for(let f in r)l.append(f,r[f]);return l.toString()},_t=class{constructor(e,i,s,r,n){this.isDead=!1,this.liveSocket=i,this.flash=r,this.parent=s,this.root=s?s.root:this,this.el=e,this.id=this.el.id,this.ref=0,this.childJoins=0,this.loaderTimer=null,this.pendingDiffs=[],this.redirect=!1,this.href=null,this.joinCount=this.parent?this.parent.joinCount-1:0,this.joinPending=!0,this.destroyed=!1,this.joinCallback=function(o){o&&o()},this.stopCallback=function(){},this.pendingJoinOps=this.parent?null:[],this.viewHooks={},this.formSubmits=[],this.children=this.parent?null:{},this.root.children[this.id]={},this.channel=this.liveSocket.channel(`lv:${this.id}`,()=>{let o=this.href&&this.expandURL(this.href);return{redirect:this.redirect?o:void 0,url:this.redirect?void 0:o||void 0,params:this.connectParams(n),session:this.getSession(),static:this.getStatic(),flash:this.flash}})}setHref(e){this.href=e}setRedirect(e){this.redirect=!0,this.href=e}isMain(){return this.el.hasAttribute(si)}connectParams(e){let i=this.liveSocket.params(this.el),s=p.all(document,`[${this.binding(gr)}]`).map(r=>r.src||r.href).filter(r=>typeof r=="string");return s.length>0&&(i._track_static=s),i._mounts=this.joinCount,i._live_referer=e,i}isConnected(){return this.channel.canPush()}getSession(){return this.el.getAttribute(ve)}getStatic(){let e=this.el.getAttribute($e);return e===""?null:e}destroy(e=function(){}){this.destroyAllChildren(),this.destroyed=!0,delete this.root.children[this.id],this.parent&&delete this.root.children[this.parent.id][this.id],clearTimeout(this.loaderTimer);let i=()=>{e();for(let s in this.viewHooks)this.destroyHook(this.viewHooks[s])};p.markPhxChildDestroyed(this.el),this.log("destroyed",()=>["the child has been removed from the parent"]),this.channel.leave().receive("ok",i).receive("error",i).receive("timeout",i)}setContainerClasses(...e){this.el.classList.remove(ls,ht,kt,hs,ii),this.el.classList.add(...e)}showLoader(e){if(clearTimeout(this.loaderTimer),e)this.loaderTimer=setTimeout(()=>this.showLoader(),e);else{for(let i in this.viewHooks)this.viewHooks[i].__disconnected();this.setContainerClasses(ht)}}execAll(e){p.all(this.el,`[${e}]`,i=>this.liveSocket.execJS(i,i.getAttribute(e)))}hideLoader(){clearTimeout(this.loaderTimer),this.setContainerClasses(ls),this.execAll(this.binding("connected"))}triggerReconnected(){for(let e in this.viewHooks)this.viewHooks[e].__reconnected()}log(e,i){this.liveSocket.log(this,e,i)}transition(e,i,s=function(){}){this.liveSocket.transition(e,i,s)}withinTargets(e,i){if(e instanceof HTMLElement||e instanceof SVGElement)return this.liveSocket.owner(e,s=>i(s,e));if(be(e))p.findComponentNodeList(this.el,e).length===0?ie(`no component found matching phx-target of ${e}`):i(this,parseInt(e));else{let s=Array.from(document.querySelectorAll(e));s.length===0&&ie(`nothing found matching the phx-target selector "${e}"`),s.forEach(r=>this.liveSocket.owner(r,n=>i(n,r)))}}applyDiff(e,i,s){this.log(e,()=>["",mt(i)]);let{diff:r,reply:n,events:o,title:a}=Ht.extract(i);s({diff:r,reply:n,events:o}),a&&window.requestAnimationFrame(()=>p.putTitle(a))}onJoin(e){let{rendered:i,container:s}=e;if(s){let[r,n]=s;this.el=p.replaceRootContainer(this.el,r,n)}this.childJoins=0,this.joinPending=!0,this.flash=null,Ie.dropLocal(this.liveSocket.localStorage,window.location.pathname,Yt),this.applyDiff("mount",i,({diff:r,events:n})=>{this.rendered=new Ht(this.id,r);let[o,a]=this.renderContainer(null,"join");this.dropPendingRefs();let l=this.formsForRecovery(o);this.joinCount++,l.length>0?l.forEach(([c,f,m],v)=>{this.pushFormRecovery(c,m,E=>{v===l.length-1&&this.onJoinComplete(E,o,a,n)})}):this.onJoinComplete(e,o,a,n)})}dropPendingRefs(){p.all(document,`[${Pe}="${this.id}"][${oe}]`,e=>{e.removeAttribute(oe),e.removeAttribute(Pe)})}onJoinComplete({live_patch:e},i,s,r){if(this.joinCount>1||this.parent&&!this.parent.isJoinPending())return this.applyJoinPatch(e,i,s,r);p.findPhxChildrenInFragment(i,this.id).filter(o=>{let a=o.id&&this.el.querySelector(`[id="${o.id}"]`),l=a&&a.getAttribute($e);return l&&o.setAttribute($e,l),a&&a.setAttribute(Re,this.root.id),this.joinChild(o)}).length===0?this.parent?(this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,i,s,r)]),this.parent.ackJoin(this)):(this.onAllChildJoinsComplete(),this.applyJoinPatch(e,i,s,r)):this.root.pendingJoinOps.push([this,()=>this.applyJoinPatch(e,i,s,r)])}attachTrueDocEl(){this.el=p.byId(this.id),this.el.setAttribute(Re,this.root.id)}execNewMounted(){let e=this.binding(ri),i=this.binding(ni);p.all(this.el,`[${e}], [${i}]`,s=>{this.maybeAddNewHook(s)}),p.all(this.el,`[${this.binding(dt)}], [data-phx-${dt}]`,s=>{this.maybeAddNewHook(s)}),p.all(this.el,`[${this.binding(us)}]`,s=>this.maybeMounted(s))}applyJoinPatch(e,i,s,r){this.attachTrueDocEl();let n=new et(this,this.el,this.id,i,s,null);if(n.markPrunableContentForRemoval(),this.performPatch(n,!1,!0),this.joinNewChildren(),this.execNewMounted(),this.joinPending=!1,this.liveSocket.dispatchEvents(r),this.applyPendingUpdates(),e){let{kind:o,to:a}=e;this.liveSocket.historyPatch(a,o)}this.hideLoader(),this.joinCount>1&&this.triggerReconnected(),this.stopCallback()}triggerBeforeUpdateHook(e,i){this.liveSocket.triggerDOM("onBeforeElUpdated",[e,i]);let s=this.getHook(e),r=s&&p.isIgnored(e,this.binding(ut));if(s&&!e.isEqualNode(i)&&!(r&&Lr(e.dataset,i.dataset)))return s.__beforeUpdate(),s}maybeMounted(e){let i=e.getAttribute(this.binding(us)),s=i&&p.private(e,"mounted");i&&!s&&(this.liveSocket.execJS(e,i),p.putPrivate(e,"mounted",!0))}maybeAddNewHook(e,i){let s=this.addHook(e);s&&s.__mounted()}performPatch(e,i,s=!1){let r=[],n=!1,o=new Set;return e.after("added",a=>{this.liveSocket.triggerDOM("onNodeAdded",[a]),this.maybeAddNewHook(a),a.getAttribute&&this.maybeMounted(a)}),e.after("phxChildAdded",a=>{p.isPhxSticky(a)?this.liveSocket.joinRootViews():n=!0}),e.before("updated",(a,l)=>{this.triggerBeforeUpdateHook(a,l)&&o.add(a.id)}),e.after("updated",a=>{o.has(a.id)&&this.getHook(a).__updated()}),e.after("discarded",a=>{a.nodeType===Node.ELEMENT_NODE&&r.push(a)}),e.after("transitionsDiscarded",a=>this.afterElementsRemoved(a,i)),e.perform(s),this.afterElementsRemoved(r,i),n}afterElementsRemoved(e,i){let s=[];e.forEach(r=>{let n=p.all(r,`[${me}]`),o=p.all(r,`[${this.binding(dt)}]`);n.concat(r).forEach(a=>{let l=this.componentID(a);be(l)&&s.indexOf(l)===-1&&s.push(l)}),o.concat(r).forEach(a=>{let l=this.getHook(a);l&&this.destroyHook(l)})}),i&&this.maybePushComponentsDestroyed(s)}joinNewChildren(){p.findPhxChildren(this.el,this.id).forEach(e=>this.joinChild(e))}getChildById(e){return this.root.children[this.id][e]}getDescendentByEl(e){return e.id===this.id?this:this.children[e.getAttribute(ze)][e.id]}destroyDescendent(e){for(let i in this.root.children)for(let s in this.root.children[i])if(s===e)return this.root.children[i][s].destroy()}joinChild(e){if(!this.getChildById(e.id)){let s=new _t(e,this.liveSocket,this);return this.root.children[this.id][s.id]=s,s.join(),this.childJoins++,!0}}isJoinPending(){return this.joinPending}ackJoin(e){this.childJoins--,this.childJoins===0&&(this.parent?this.parent.ackJoin(this):this.onAllChildJoinsComplete())}onAllChildJoinsComplete(){this.joinCallback(()=>{this.pendingJoinOps.forEach(([e,i])=>{e.isDestroyed()||i()}),this.pendingJoinOps=[]})}update(e,i){if(this.isJoinPending()||this.liveSocket.hasPendingLink()&&this.root.isMain())return this.pendingDiffs.push({diff:e,events:i});this.rendered.mergeDiff(e);let s=!1;this.rendered.isComponentOnlyDiff(e)?this.liveSocket.time("component patch complete",()=>{p.findParentCIDs(this.el,this.rendered.componentCIDs(e)).forEach(n=>{this.componentPatch(this.rendered.getComponent(e,n),n)&&(s=!0)})}):vs(e)||this.liveSocket.time("full patch complete",()=>{let[r,n]=this.renderContainer(e,"update"),o=new et(this,this.el,this.id,r,n,null);s=this.performPatch(o,!0)}),this.liveSocket.dispatchEvents(i),s&&this.joinNewChildren()}renderContainer(e,i){return this.liveSocket.time(`toString diff (${i})`,()=>{let s=this.el.tagName,r=e?this.rendered.componentCIDs(e):null,[n,o]=this.rendered.toString(r);return[`<${s}>${n}`,o]})}componentPatch(e,i){if(vs(e))return!1;let[s,r]=this.rendered.componentToString(i),n=new et(this,this.el,this.id,s,r,i);return this.performPatch(n,!0)}getHook(e){return this.viewHooks[Ve.elementID(e)]}addHook(e){if(Ve.elementID(e)||!e.getAttribute)return;let i=e.getAttribute(`data-phx-${dt}`)||e.getAttribute(this.binding(dt));if(i&&!this.ownsElement(e))return;let s=this.liveSocket.getHookCallbacks(i);if(s){e.id||ie(`no DOM ID for hook "${i}". Hooks require a unique ID on each element.`,e);let r=new Ve(this,e,s);return this.viewHooks[Ve.elementID(r.el)]=r,r}else i!==null&&ie(`unknown hook found for "${i}"`,e)}destroyHook(e){e.__destroyed(),e.__cleanup__(),delete this.viewHooks[Ve.elementID(e.el)]}applyPendingUpdates(){this.pendingDiffs.forEach(({diff:e,events:i})=>this.update(e,i)),this.pendingDiffs=[],this.eachChild(e=>e.applyPendingUpdates())}eachChild(e){let i=this.root.children[this.id]||{};for(let s in i)e(this.getChildById(s))}onChannel(e,i){this.liveSocket.onChannel(this.channel,e,s=>{this.isJoinPending()?this.root.pendingJoinOps.push([this,()=>i(s)]):this.liveSocket.requestDOMUpdate(()=>i(s))})}bindChannel(){this.liveSocket.onChannel(this.channel,"diff",e=>{this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",e,({diff:i,events:s})=>this.update(i,s))})}),this.onChannel("redirect",({to:e,flash:i})=>this.onRedirect({to:e,flash:i})),this.onChannel("live_patch",e=>this.onLivePatch(e)),this.onChannel("live_redirect",e=>this.onLiveRedirect(e)),this.channel.onError(e=>this.onError(e)),this.channel.onClose(e=>this.onClose(e))}destroyAllChildren(){this.eachChild(e=>e.destroy())}onLiveRedirect(e){let{to:i,kind:s,flash:r}=e,n=this.expandURL(i);this.liveSocket.historyRedirect(n,s,r)}onLivePatch(e){let{to:i,kind:s}=e;this.href=this.expandURL(i),this.liveSocket.historyPatch(i,s)}expandURL(e){return e.startsWith("/")?`${window.location.protocol}//${window.location.host}${e}`:e}onRedirect({to:e,flash:i}){this.liveSocket.redirect(e,i)}isDestroyed(){return this.destroyed}joinDead(){this.isDead=!0}join(e){this.showLoader(this.liveSocket.loaderTimeout),this.bindChannel(),this.isMain()&&(this.stopCallback=this.liveSocket.withPageLoading({to:this.href,kind:"initial"})),this.joinCallback=i=>{i=i||function(){},e?e(this.joinCount,i):i()},this.liveSocket.wrapPush(this,{timeout:!1},()=>this.channel.join().receive("ok",i=>{this.isDestroyed()||this.liveSocket.requestDOMUpdate(()=>this.onJoin(i))}).receive("error",i=>!this.isDestroyed()&&this.onJoinError(i)).receive("timeout",()=>!this.isDestroyed()&&this.onJoinError({reason:"timeout"})))}onJoinError(e){if(e.reason==="reload"){this.log("error",()=>[`failed mount with ${e.status}. Falling back to page request`,e]),this.isMain()&&this.onRedirect({to:this.href});return}else if(e.reason==="unauthorized"||e.reason==="stale"){this.log("error",()=>["unauthorized live_redirect. Falling back to page request",e]),this.isMain()&&this.onRedirect({to:this.href});return}if((e.redirect||e.live_redirect)&&(this.joinPending=!1,this.channel.leave()),e.redirect)return this.onRedirect(e.redirect);if(e.live_redirect)return this.onLiveRedirect(e.live_redirect);this.displayError([ht,kt,ii]),this.log("error",()=>["unable to join",e]),this.liveSocket.isConnected()&&this.liveSocket.reloadWithJitter(this)}onClose(e){if(!this.isDestroyed()){if(this.liveSocket.hasPendingLink()&&e!=="leave")return this.liveSocket.reloadWithJitter(this);this.destroyAllChildren(),this.liveSocket.dropActiveElement(this),document.activeElement&&document.activeElement.blur(),this.liveSocket.isUnloaded()&&this.showLoader(Tr)}}onError(e){this.onClose(e),this.liveSocket.isConnected()&&this.log("error",()=>["view crashed",e]),this.liveSocket.isUnloaded()||(this.liveSocket.isConnected()?this.displayError([ht,kt,ii]):this.displayError([ht,kt,hs]))}displayError(e){this.isMain()&&p.dispatchEvent(window,`${$}:page-loading-start`,{detail:{to:this.href,kind:"error"}}),this.showLoader(),this.setContainerClasses(...e),this.execAll(this.binding("disconnected"))}pushWithReply(e,i,s,r=function(){}){if(!this.isConnected())return;let[n,[o],a]=e?e():[null,[],{}],l=function(){};return(a.page_loading||o&&o.getAttribute(this.binding(as))!==null)&&(l=this.liveSocket.withPageLoading({kind:"element",target:o})),typeof s.cid!="number"&&delete s.cid,this.liveSocket.wrapPush(this,{timeout:!0},()=>this.channel.push(i,s,Cr).receive("ok",c=>{let f=m=>{c.redirect&&this.onRedirect(c.redirect),c.live_patch&&this.onLivePatch(c.live_patch),c.live_redirect&&this.onLiveRedirect(c.live_redirect),l(),r(c,m)};c.diff?this.liveSocket.requestDOMUpdate(()=>{this.applyDiff("update",c.diff,({diff:m,reply:v,events:E})=>{n!==null&&this.undoRefs(n),this.update(m,E),f(v)})}):(n!==null&&this.undoRefs(n),f(null))}))}undoRefs(e){!this.isConnected()||p.all(document,`[${Pe}="${this.id}"][${oe}="${e}"]`,i=>{let s=i.getAttribute(Qe),r=i.getAttribute(ai);i.removeAttribute(oe),i.removeAttribute(Pe),r!==null&&(i.readOnly=r==="true",i.removeAttribute(ai)),s!==null&&(i.disabled=s==="true",i.removeAttribute(Qe)),Qt.forEach(a=>p.removeClass(i,a));let n=i.getAttribute(It);n!==null&&(i.innerText=n,i.removeAttribute(It));let o=p.private(i,oe);if(o){let a=this.triggerBeforeUpdateHook(i,o);et.patchEl(i,o,this.liveSocket.getActiveElement()),a&&a.__updated(),p.deletePrivate(i,oe)}})}putRef(e,i,s={}){let r=this.ref++,n=this.binding(Rt);return s.loading&&(e=e.concat(p.all(document,s.loading))),e.forEach(o=>{o.classList.add(`phx-${i}-loading`),o.setAttribute(oe,r),o.setAttribute(Pe,this.el.id);let a=o.getAttribute(n);a!==null&&(o.getAttribute(It)||o.setAttribute(It,o.innerText),a!==""&&(o.innerText=a),o.setAttribute(Qe,o.getAttribute(Qe)||o.disabled),o.setAttribute("disabled",""))}),[r,e,s]}componentID(e){let i=e.getAttribute&&e.getAttribute(me);return i?parseInt(i):null}targetComponentID(e,i,s={}){if(be(i))return i;let r=s.target||e.getAttribute(this.binding("target"));return be(r)?parseInt(r):i&&(r!==null||s.target)?this.closestComponentID(i):null}closestComponentID(e){return be(e)?e:e?Ae(e.closest(`[${me}]`),i=>this.ownsElement(i)&&this.componentID(i)):null}pushHookEvent(e,i,s,r,n){if(!this.isConnected())return this.log("hook",()=>["unable to push hook event. LiveView not connected",s,r]),!1;let[o,a,l]=this.putRef([e],"hook");return this.pushWithReply(()=>[o,a,l],"event",{type:"hook",event:s,value:r,cid:this.closestComponentID(i)},(c,f)=>n(f,o)),o}extractMeta(e,i,s){let r=this.binding("value-");for(let n=0;n=0&&!e.checked&&delete i.value),s){i||(i={});for(let n in s)i[n]=s[n]}return i}pushEvent(e,i,s,r,n,o={},a){this.pushWithReply(()=>this.putRef([i],e,o),"event",{type:e,event:r,value:this.extractMeta(i,n,o.value),cid:this.targetComponentID(i,s,o)},(l,c)=>a&&a(c))}pushFileProgress(e,i,s,r=function(){}){this.liveSocket.withinOwners(e.form,(n,o)=>{n.pushWithReply(null,"progress",{event:e.getAttribute(n.binding(wr)),ref:e.getAttribute(ge),entry_ref:i,progress:s,cid:n.targetComponentID(e.form,o)},r)})}pushInput(e,i,s,r,n,o){let a,l=be(s)?s:this.targetComponentID(e.form,i,n),c=()=>this.putRef([e,e.form],"change",n),f,m=this.extractMeta(e.form);e instanceof HTMLButtonElement&&(m.submitter=e),e.getAttribute(this.binding("change"))?f=bi(e.form,O({_target:n._target},m),[e.name]):f=bi(e.form,O({_target:n._target},m)),p.isUploadInput(e)&&e.files&&e.files.length>0&&X.trackFiles(e,Array.from(e.files)),a=X.serializeUploads(e);let v={type:"form",event:r,value:f,uploads:a,cid:l};this.pushWithReply(c,"event",v,E=>{if(p.showError(e,this.liveSocket.binding(Ge),this.liveSocket.binding(Ye)),p.isUploadInput(e)&&p.isAutoUpload(e)){if(X.filesAwaitingPreflight(e).length>0){let[b,w]=c();this.uploadFiles(e.form,i,b,l,N=>{o&&o(E),this.triggerAwaitingSubmit(e.form),this.undoRefs(b)})}}else o&&o(E)})}triggerAwaitingSubmit(e){let i=this.getScheduledSubmit(e);if(i){let[s,r,n,o]=i;this.cancelSubmit(e),o()}}getScheduledSubmit(e){return this.formSubmits.find(([i,s,r,n])=>i.isSameNode(e))}scheduleSubmit(e,i,s,r){if(this.getScheduledSubmit(e))return!0;this.formSubmits.push([e,i,s,r])}cancelSubmit(e){this.formSubmits=this.formSubmits.filter(([i,s,r])=>i.isSameNode(e)?(this.undoRefs(s),!1):!0)}disableForm(e,i={}){let s=m=>!(gt(m,`${this.binding(ut)}=ignore`,m.form)||gt(m,"data-phx-update=ignore",m.form)),r=m=>m.hasAttribute(this.binding(Rt)),n=m=>m.tagName=="BUTTON",o=m=>["INPUT","TEXTAREA","SELECT"].includes(m.tagName),a=Array.from(e.elements),l=a.filter(r),c=a.filter(n).filter(s),f=a.filter(o).filter(s);return c.forEach(m=>{m.setAttribute(Qe,m.disabled),m.disabled=!0}),f.forEach(m=>{m.setAttribute(ai,m.readOnly),m.readOnly=!0,m.files&&(m.setAttribute(Qe,m.disabled),m.disabled=!0)}),e.setAttribute(this.binding(as),""),this.putRef([e].concat(l).concat(c).concat(f),"submit",i)}pushFormSubmit(e,i,s,r,n,o){let a=()=>this.disableForm(e,n),l=this.targetComponentID(e,i);if(X.hasUploadsInProgress(e)){let[c,f]=a(),m=()=>this.pushFormSubmit(e,i,s,r,n,o);return this.scheduleSubmit(e,c,n,m)}else if(X.inputsAwaitingPreflight(e).length>0){let[c,f]=a(),m=()=>[c,f,n];this.uploadFiles(e,i,c,l,v=>{let E=this.extractMeta(e),b=bi(e,O({submitter:r},E));this.pushWithReply(m,"event",{type:"form",event:s,value:b,cid:l},o)})}else if(!(e.hasAttribute(oe)&&e.classList.contains("phx-submit-loading"))){let c=this.extractMeta(e),f=bi(e,O({submitter:r},c));this.pushWithReply(a,"event",{type:"form",event:s,value:f,cid:l},o)}}uploadFiles(e,i,s,r,n){let o=this.joinCount,a=X.activeFileInputs(e),l=a.length;a.forEach(c=>{let f=new X(c,this,()=>{l--,l===0&&n()}),m=f.entries().map(E=>E.toPreflightPayload());if(m.length===0){l--;return}let v={ref:c.getAttribute(ge),entries:m,cid:this.targetComponentID(c.form,i)};this.log("upload",()=>["sending preflight request",v]),this.pushWithReply(null,"allow_upload",v,E=>{if(this.log("upload",()=>["got preflight response",E]),E.error){this.undoRefs(s);let[b,w]=E.error;this.log("upload",()=>[`error for entry ${b}`,w])}else{let b=w=>{this.channel.onError(()=>{this.joinCount===o&&w()})};f.initAdapterUpload(E,b,this.liveSocket)}})})}dispatchUploads(e,i,s){let r=this.targetCtxElement(e)||this.el,n=p.findUploadInputs(r).filter(o=>o.name===i);n.length===0?ie(`no live file inputs found matching the name "${i}"`):n.length>1?ie(`duplicate live file inputs found matching the name "${i}"`):p.dispatchEvent(n[0],Zt,{detail:{files:s}})}targetCtxElement(e){if(be(e)){let[i]=p.findComponentNodeList(this.el,e);return i}else return e||null}pushFormRecovery(e,i,s){this.liveSocket.withinOwners(e,(r,n)=>{let o=this.binding("change"),a=Array.from(e.elements).filter(f=>p.isFormInput(f)&&f.name&&!f.hasAttribute(o));if(a.length===0)return;a.forEach(f=>f.hasAttribute(ge)&&X.clearFiles(f));let l=a.find(f=>f.type!=="hidden")||a[0],c=e.getAttribute(this.binding(ds))||e.getAttribute(this.binding("change"));ee.exec("change",c,r,l,["push",{_target:l.name,newCid:i,callback:s}])})}pushLinkPatch(e,i,s){let r=this.liveSocket.setPendingLink(e),n=i?()=>this.putRef([i],"click"):null,o=()=>this.liveSocket.redirect(window.location.href),a=e.startsWith("/")?`${location.protocol}//${location.host}${e}`:e,l=this.pushWithReply(n,"live_patch",{url:a},c=>{this.liveSocket.requestDOMUpdate(()=>{c.link_redirect?this.liveSocket.replaceMain(e,null,s,r):(this.liveSocket.commitPendingLink(r)&&(this.href=e),this.applyPendingUpdates(),s&&s(r))})});l?l.receive("timeout",o):o()}formsForRecovery(e){if(this.joinCount===0)return[];let i=this.binding("change"),s=document.createElement("template");return s.innerHTML=e,p.all(this.el,`form[${i}]`).filter(r=>r.id&&this.ownsElement(r)).filter(r=>r.elements.length>0).filter(r=>r.getAttribute(this.binding(ds))!=="ignore").map(r=>{let n=CSS.escape(r.getAttribute(i)),o=s.content.querySelector(`form[id="${r.id}"][${i}="${n}"]`);return o?[r,o,this.targetComponentID(o)]:[r,r,this.targetComponentID(r)]}).filter(([r,n,o])=>n)}maybePushComponentsDestroyed(e){let i=e.filter(s=>p.findComponentNodeList(this.el,s).length===0);i.length>0&&(i.forEach(s=>this.rendered.resetRender(s)),this.pushWithReply(null,"cids_will_destroy",{cids:i},()=>{let s=i.filter(r=>p.findComponentNodeList(this.el,r).length===0);s.length>0&&this.pushWithReply(null,"cids_destroyed",{cids:s},r=>{this.rendered.pruneCIDs(r.cids)})}))}ownsElement(e){let i=e.closest(He);return e.getAttribute(ze)===this.id||i&&i.id===this.id||!i&&this.isDead}submitForm(e,i,s,r,n={}){p.putPrivate(e,ct,!0);let o=this.liveSocket.binding(Ge),a=this.liveSocket.binding(Ye),l=Array.from(e.elements);l.forEach(c=>p.putPrivate(c,ct,!0)),this.liveSocket.blurActiveElement(this),this.pushFormSubmit(e,i,s,r,n,()=>{l.forEach(c=>p.showError(c,o,a)),this.liveSocket.restorePreviouslyActiveFocus()})}binding(e){return this.liveSocket.binding(e)}};var Mt=class{constructor(e,i,s={}){if(this.unloaded=!1,!i||i.constructor.name==="Object")throw new Error(` a phoenix Socket must be provided as the second argument to the LiveSocket constructor. For example: import {Socket} from "phoenix" import {LiveSocket} from "phoenix_live_view" let liveSocket = new LiveSocket("/live", Socket, {...}) `);this.socket=new i(e,s),this.bindingPrefix=s.bindingPrefix||xr,this.opts=s,this.params=pi(s.params||{}),this.viewLogger=s.viewLogger,this.metadataCallbacks=s.metadata||{},this.defaults=Object.assign(mt(kr),s.defaults||{}),this.activeElement=null,this.prevActive=null,this.silenced=!1,this.main=null,this.outgoingMainEl=null,this.clickStartedAtTarget=null,this.linkRef=1,this.roots={},this.href=window.location.href,this.pendingLink=null,this.currentLocation=mt(window.location),this.hooks=s.hooks||{},this.uploaders=s.uploaders||{},this.loaderTimeout=s.loaderTimeout||Ar,this.reloadWithJitterTimer=null,this.maxReloads=s.maxReloads||ur,this.reloadJitterMin=s.reloadJitterMin||fr,this.reloadJitterMax=s.reloadJitterMax||pr,this.failsafeJitter=s.failsafeJitter||mr,this.localStorage=s.localStorage||window.localStorage,this.sessionStorage=s.sessionStorage||window.sessionStorage,this.boundTopLevelEvents=!1,this.domCallbacks=Object.assign({onNodeAdded:pi(),onBeforeElUpdated:pi()},s.dom||{}),this.doofinderMount=s.doofinderMount,this.connectCallback=s.connectCallback||(()=>{}),this.disconnectCallback=s.disconnectCallback||(()=>{}),this.unbindFunctions=[],this.transitions=new jr,window.addEventListener("pagehide",r=>{this.unloaded=!0}),this.socket.onOpen(()=>{this.isUnloaded()&&window.location.reload()}),this.socket.onOpen(()=>{this.connectCallback()})}isProfileEnabled(){return this.sessionStorage.getItem(ci)==="true"}isDebugEnabled(){return this.sessionStorage.getItem(Lt)==="true"}isDebugDisabled(){return this.sessionStorage.getItem(Lt)==="false"}enableDebug(){this.sessionStorage.setItem(Lt,"true")}enableProfiling(){this.sessionStorage.setItem(ci,"true")}disableDebug(){this.sessionStorage.setItem(Lt,"false")}disableProfiling(){this.sessionStorage.removeItem(ci)}enableLatencySim(e){this.enableDebug(),console.log("latency simulator enabled for the duration of this browser session. Call disableLatencySim() to disable"),this.sessionStorage.setItem(di,e)}disableLatencySim(){this.sessionStorage.removeItem(di)}getLatencySim(){let e=this.sessionStorage.getItem(di);return e?parseInt(e):null}getSocket(){return this.socket}connect(){window.location.hostname==="localhost"&&!this.isDebugDisabled()&&this.enableDebug(),this.joinRootViews()&&(this.bindTopLevelEvents(),this.socket.connect())}disconnect(e){clearTimeout(this.reloadWithJitterTimer),this.socket.disconnect(e)}replaceTransport(e){clearTimeout(this.reloadWithJitterTimer),this.socket.replaceTransport(e),this.connect()}execJS(e,i,s=null){this.owner(e,r=>ee.exec(s,i,r,e))}execJSHookPush(e,i,s,r){this.withinOwners(e,n=>{ee.exec("hook",i,n,e,["push",{data:s,callback:r}])})}unload(){this.unloaded||(this.main&&this.isConnected()&&this.log(this.main,"socket",()=>["disconnect for page nav"]),this.unloaded=!0,this.destroyAllViews(),this.disconnect())}triggerDOM(e,i){this.domCallbacks[e](...i)}time(e,i){if(!this.isProfileEnabled()||!console.time)return i();console.time(e);let s=i();return console.timeEnd(e),s}log(e,i,s){if(this.viewLogger){let[r,n]=s();this.viewLogger(e,i,r,n)}else if(this.isDebugEnabled()){let[r,n]=s();Ir(e,i,r,n)}}requestDOMUpdate(e){this.transitions.after(e)}transition(e,i,s=function(){}){this.transitions.addTransition(e,i,s)}onChannel(e,i,s){e.on(i,r=>{let n=this.getLatencySim();n?setTimeout(()=>s(r),n):s(r)})}wrapPush(e,i,s){let r=this.getLatencySim(),n=e.joinCount;if(!r)return this.isConnected()&&i.timeout?s().receive("timeout",()=>{e.joinCount===n&&!e.isDestroyed()&&this.reloadWithJitter(e,()=>{this.log(e,"timeout",()=>["received timeout while communicating with server. Falling back to hard refresh for recovery"])})}):s();let o={receives:[],receive(a,l){this.receives.push([a,l])}};return setTimeout(()=>{e.isDestroyed()||o.receives.reduce((a,[l,c])=>a.receive(l,c),s())},r),o}reloadWithJitter(e,i){clearTimeout(this.reloadWithJitterTimer),this.disconnect();let s=this.reloadJitterMin,r=this.reloadJitterMax,n=Math.floor(Math.random()*(r-s+1))+s;Ie.updateLocal(this.localStorage,window.location.pathname,Yt,0,a=>a+1)>this.maxReloads&&(n=this.failsafeJitter),this.reloadWithJitterTimer=setTimeout(()=>{this.disconnectCallback()},n)}getHookCallbacks(e){return e&&e.startsWith("Phoenix.")?Mr[e.split(".")[1]]:this.hooks[e]}isUnloaded(){return this.unloaded}isConnected(){return this.socket.isConnected()}getBindingPrefix(){return this.bindingPrefix}binding(e){return`${this.getBindingPrefix()}${e}`}channel(e,i){return this.socket.channel(e,i)}joinRootViews(){if(this.doofinderMount){let e=this.newRootView(this.doofinderMount);return e.setHref(this.getHref()),e.join(),this.main=e,!0}else return!1}redirect(e,i){this.disconnect(this.disconnectCallback),Ie.redirect(e,i)}replaceMain(e,i,s=null,r=this.setPendingLink(e)){let n=this.currentLocation.href;this.outgoingMainEl=this.outgoingMainEl||this.main.el;let o=p.cloneNode(this.outgoingMainEl,"");this.main.showLoader(this.loaderTimeout),this.main.destroy(),this.main=this.newRootView(o,i,n),this.main.setRedirect(e),this.transitionRemoves(null,!0),this.main.join((a,l)=>{a===1&&this.commitPendingLink(r)&&this.requestDOMUpdate(()=>{p.findPhxSticky(document).forEach(c=>o.appendChild(c)),this.outgoingMainEl.replaceWith(o),this.outgoingMainEl=null,s&&s(r),l()})})}transitionRemoves(e,i){let s=this.binding("remove");if(e=e||p.all(document,`[${s}]`),i){let r=p.findPhxSticky(document)||[];e=e.filter(n=>!p.isChildOfAny(n,r))}e.forEach(r=>{this.execJS(r,r.getAttribute(s),"remove")})}isPhxView(e){return e.getAttribute&&e.getAttribute(ve)!==null}newRootView(e,i,s){let r=new _t(e,this,null,i,s);return this.roots[r.id]=r,r}owner(e,i){let s=Ae(e.closest(He),r=>this.getViewByEl(r))||this.main;s&&i(s)}withinOwners(e,i){this.owner(e,s=>i(s,e))}getViewByEl(e){let i=e.getAttribute(Re);return Ae(this.getRootById(i),s=>s.getDescendentByEl(e))}getRootById(e){return this.roots[e]}destroyAllViews(){for(let e in this.roots)this.roots[e].destroy(),delete this.roots[e];this.main=null}destroyViewByEl(e){let i=this.getRootById(e.getAttribute(Re));i&&i.id===e.id?(i.destroy(),delete this.roots[i.id]):i&&i.destroyDescendent(e.id)}setActiveElement(e){if(this.activeElement===e)return;this.activeElement=e;let i=()=>{e===this.activeElement&&(this.activeElement=null),e.removeEventListener("mouseup",this),e.removeEventListener("touchend",this)};e.addEventListener("mouseup",i),e.addEventListener("touchend",i)}getActiveElement(){return document.activeElement===document.body?this.activeElement||document.activeElement:document.activeElement||document.body}dropActiveElement(e){this.prevActive&&e.ownsElement(this.prevActive)&&(this.prevActive=null)}restorePreviouslyActiveFocus(){this.prevActive&&this.prevActive!==document.body&&this.prevActive.focus()}blurActiveElement(){this.prevActive=this.getActiveElement(),this.prevActive!==document.body&&this.prevActive.blur()}bindTopLevelEvents({dead:e}={}){this.boundTopLevelEvents||(this.boundTopLevelEvents=!0,this.socket.onClose(i=>{if(i&&i.code===1e3&&this.main)return this.reloadWithJitter(this.main)}),this.unbindFunctions.push((()=>{let i=function(){};return document.body.addEventListener("click",i),function(){document.body.removeEventListener("click",i)}})()),window.addEventListener("pageshow",i=>{i.persisted&&(this.getSocket().disconnect(),this.withPageLoading({to:window.location.href,kind:"redirect"}),window.location.reload())},!0),this.bindClicks(),e||this.bindForms(),this.bind({keyup:"keyup",keydown:"keydown"},(i,s,r,n,o,a)=>{let l=n.getAttribute(this.binding(Er)),c=i.key&&i.key.toLowerCase();if(l&&l.toLowerCase()!==c)return;let f=O({key:i.key},this.eventMeta(s,i,n));ee.exec(s,o,r,n,["push",{data:f}])}),this.bind({blur:"focusout",focus:"focusin"},(i,s,r,n,o,a)=>{if(!a){let l=O({key:i.key},this.eventMeta(s,i,n));ee.exec(s,o,r,n,["push",{data:l}])}}),this.bind({blur:"blur",focus:"focus"},(i,s,r,n,o,a)=>{if(a==="window"){let l=this.eventMeta(s,i,n);ee.exec(s,o,r,n,["push",{data:l}])}}),this.unbindFunctions.push((()=>{let i=s=>s.preventDefault();return this.doofinderMount.addEventListener("dragover",i),()=>this.doofinderMount.removeEventListener("dragover",i)})()),this.unbindFunctions.push((()=>{let i=s=>{s.preventDefault();let r=Ae(gt(s.target,this.binding(ns)),a=>a.getAttribute(this.binding(ns))),n=r&&document.getElementById(r),o=Array.from(s.dataTransfer.files||[]);!n||n.disabled||o.length===0||!(n.files instanceof FileList)||(X.trackFiles(n,o,s.dataTransfer),n.dispatchEvent(new Event("input",{bubbles:!0})))};return this.doofinderMount.addEventListener("drop",i),()=>this.doofinderMount.removeEventListener("drop",i)})()),this.on(Zt,i=>{let s=i.target;if(!p.isUploadInput(s))return;let r=Array.from(i.detail.files||[]).filter(n=>n instanceof File||n instanceof Blob);X.trackFiles(s,r),s.dispatchEvent(new Event("input",{bubbles:!0}))},this.doofinderMount))}unbindTopLevelEvents(){this.unbindFunctions.forEach(e=>e()),this.unbindFunctions=[]}eventMeta(e,i,s){let r=this.metadataCallbacks[e];return r?r(i,s):{}}setPendingLink(e){return this.linkRef++,this.pendingLink=e,this.linkRef}commitPendingLink(e){return this.linkRef!==e?!1:(this.href=this.pendingLink,this.pendingLink=null,!0)}getHref(){return this.href}hasPendingLink(){return!!this.pendingLink}bind(e,i){for(let s in e){let r=e[s];this.on(r,n=>{let o=this.binding(s),a=this.binding(`window-${s}`),l=n.target.getAttribute&&n.target.getAttribute(o);l?this.debounce(n.target,n,r,()=>{this.withinOwners(n.target,c=>{i(n,s,c,n.target,l,null)})}):p.all(document,`[${a}]`,c=>{let f=c.getAttribute(a);this.debounce(c,n,r,()=>{this.withinOwners(c,m=>{i(n,s,m,c,f,"window")})})})},this.doofinderMount)}}bindClicks(){let e=i=>{this.clickStartedAtTarget=i.target};this.doofinderMount.addEventListener("click",e),this.unbindFunctions.push(()=>this.doofinderMount.removeEventListener("click",e)),this.bindClick("click","click",!1),this.bindClick("mousedown","capture-click",!0)}bindClick(e,i,s){let r=this.binding(i),n=o=>{if(!this.isConnected())return;let a=null;if(s)a=o.target.matches(`[${r}]`)?o.target:o.target.querySelector(`[${r}]`);else{o.detail===0&&(this.clickStartedAtTarget=o.target);let c=this.clickStartedAtTarget||o.target;a=gt(c,r),this.dispatchClickAway(o,c),this.clickStartedAtTarget=null}let l=a&&a.getAttribute(r);if(!l){!s&&p.isNewPageClick(o,window.location)&&this.unload();return}a.getAttribute("href")==="#"&&o.preventDefault(),!a.hasAttribute(oe)&&(a.disabled||this.debounce(a,o,"click",()=>{this.withinOwners(a,c=>{ee.exec("click",l,c,a,["push",{data:this.eventMeta("click",o,a)}])})}))};this.doofinderMount.addEventListener(e,n,s),this.unbindFunctions.push(()=>this.doofinderMount.removeEventListener(e,n,s))}dispatchClickAway(e,i){let s=this.binding("click-away");p.all(document,`[${s}]`,r=>{r.isSameNode(i)||r.contains(i)||this.withinOwners(r,n=>{let o=r.getAttribute(s);ee.isVisible(r)&&ee.isInViewport(r)&&ee.exec("click",o,n,r,["push",{data:this.eventMeta("click",e,e.target)}])})})}maybeScroll(e){typeof e=="number"&&requestAnimationFrame(()=>{window.scrollTo(0,e)})}dispatchEvent(e,i={}){p.dispatchEvent(this.doofinderMount,`${$}:${e}`,{detail:i})}dispatchEvents(e){e.forEach(([i,s])=>this.dispatchEvent(i,s))}withPageLoading(e,i){p.dispatchEvent(this.doofinderMount,`${$}:page-loading-start`,{detail:e});let s=()=>p.dispatchEvent(this.doofinderMount,`${$}:page-loading-stop`,{detail:e});return i?i(s):s}pushHistoryPatch(e,i,s){if(!this.isConnected()||!this.main.isMain())return Ie.redirect(e);this.withPageLoading({to:e,kind:"patch"},r=>{this.main.pushLinkPatch(e,s,n=>{this.historyPatch(e,i,n),r()})})}historyPatch(e,i,s=this.setPendingLink(e)){!this.commitPendingLink(s)||(Ie.pushState(i,{type:"patch",id:this.main.id},e),p.dispatchEvent(window,`${$}:navigate`,{detail:{patch:!0,href:e,pop:!1}}),this.registerNewLocation(window.location))}historyRedirect(e,i,s){if(!this.isConnected()||!this.main.isMain())return Ie.redirect(e,s);if(/^\/$|^\/[^\/]+.*$/.test(e)){let{protocol:n,host:o}=window.location;e=`${n}//${o}${e}`}let r=window.scrollY;this.withPageLoading({to:e,kind:"redirect"},n=>{this.replaceMain(e,s,o=>{o===this.linkRef&&(Ie.pushState(i,{type:"redirect",id:this.main.id,scroll:r},e),p.dispatchEvent(window,`${$}:navigate`,{detail:{href:e,patch:!1,pop:!1}}),this.registerNewLocation(window.location)),n()})})}replaceRootHistory(){Ie.pushState("replace",{root:!0,type:"patch",id:this.main.id})}registerNewLocation(e){let{pathname:i,search:s}=this.currentLocation;return i+s===e.pathname+e.search?!1:(this.currentLocation=mt(e),!0)}bindForms(){let e=0,i=!1;this.on("submit",s=>{let r=s.target.getAttribute(this.binding("submit")),n=s.target.getAttribute(this.binding("change"));!i&&n&&!r&&(i=!0,s.preventDefault(),s.stopPropagation(),this.withinOwners(s.target,o=>{o.disableForm(s.target),window.requestAnimationFrame(()=>{p.isUnloadableFormSubmit(s)&&this.unload(),s.target.submit()})}))},this.doofinderMount),this.on("submit",s=>{let r=s.target.getAttribute(this.binding("submit"));if(!r){p.isUnloadableFormSubmit(s)&&this.unload();return}s.preventDefault(),s.stopPropagation(),s.target.disabled=!0,this.withinOwners(s.target,n=>{ee.exec("submit",r,n,s.target,["push",{submitter:s.submitter}])})},this.doofinderMount);for(let s of["change","input"])this.on(s,r=>{r.stopPropagation();let n=this.binding("change"),o=r.target,a=o.getAttribute(n),l=o.form&&o.form.getAttribute(n),c=a||l;if(!c||o.type==="number"&&o.validity&&o.validity.badInput)return;let f=a?o:o.form,m=e;e++;let{at:v,type:E}=p.private(o,"prev-iteration")||{};v===m-1&&s==="change"&&E==="input"||(p.putPrivate(o,"prev-iteration",{at:m,type:s}),this.debounce(o,r,s,()=>{this.withinOwners(f,b=>{p.putPrivate(o,Pt,!0),p.isTextualInput(o)||this.setActiveElement(o),ee.exec("change",c,b,o,["push",{_target:r.target.name,dispatcher:f}])})}))},this.doofinderMount);this.on("reset",s=>{let r=s.target;p.resetForm(r,this.binding(Ge),this.binding(Ye));let n=Array.from(r.elements).find(o=>o.type==="reset");n&&window.requestAnimationFrame(()=>{n.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!1}))})})}debounce(e,i,s,r){if(s==="blur"||s==="focusout")return r();let n=this.binding(yr),o=this.binding(Sr),a=this.defaults.debounce.toString(),l=this.defaults.throttle.toString();this.withinOwners(e,c=>{let f=()=>!c.isDestroyed()&&document.body.contains(e);p.debounce(e,i,n,a,o,l,f,()=>{r()})})}silenceEvents(e){this.silenced=!0,e(),this.silenced=!1}on(e,i,s=window){let r=n=>{this.silenced||i(n)};s.addEventListener(e,r),this.unbindFunctions.push(function(){s.removeEventListener(e,r)})}},jr=class{constructor(){this.transitions=new Set,this.pendingOps=[]}reset(){this.transitions.forEach(e=>{clearTimeout(e),this.transitions.delete(e)}),this.flushPendingOps()}after(e){this.size()===0?e():this.pushPendingOp(e)}addTransition(e,i,s){i();let r=setTimeout(()=>{this.transitions.delete(r),s(),this.flushPendingOps()},e);this.transitions.add(r)}pushPendingOp(e){this.pendingOps.push(e)}size(){return this.transitions.size}flushPendingOps(){if(this.size()>0)return;let e=this.pendingOps.shift();e&&(e(),this.flushPendingOps())}};var Ss=class{constructor(e){let{url:i,mount:s,hooks:r,params:n,mainHook:o,appName:a,disconnectCallback:l}=e,c={hooks:r,doofinderMount:s,params:n,metadata:{click:function(f){return{keys:{altKey:f.altKey,shiftKey:f.shiftKey,ctrlKey:f.ctrlKey,metaKey:f.metaKey}}}},disconnectCallback:l};this.__mainHook=o,this.__socket=new Mt(i,rs,c),this.__appName=a}get connected(){return this.__socket.isConnected()}enableDebug(){this.__socket.enableDebug()}disableDebug(){this.__socket.disableDebug()}setPreventReconnect(e=!1){this.__socket.preventReconnect=e}getHooksByName(e){if(this.connected){let i=this.__socket.doofinderMount,s=this.__socket.getViewByEl(i);return Array.from(i.querySelectorAll(`[dfd-hook="${e}"]`)).map(n=>s.getHook(n))}else return[]}connect(e){this.connected||this.__socket.connect(),Doofinder.Session.setLive(this.__appName),e()}disconnect(e){this.__socket.unbindTopLevelEvents(),this.__socket.destroyAllViews(),this.__socket.disconnect(e),this.__socket=null}pushEvent(e,i={},s=void 0){let[r]=this.getHooksByName(this.__mainHook);if(!r)throw new Error(`${this.__mainHook} hook is not ready!`);r.pushEvent(e,i,s)}};var $o="df-cookies-allowed",Uo=window.localStorage;function Xr(){return JSON.parse(Uo.getItem($o)||"false")}var vt=class{constructor(e,i){this._bucket=e,this._store=i||window.localStorage}get data(){return JSON.parse(this._store.getItem(this._bucket))||{}}set data(e){!Xr()||this._store.setItem(this._bucket,JSON.stringify(e))}getItem(e){return this.data[e]}setItem(e,i){let s=this.data;s[e]=i,this.data=s}removeItem(e){let i=this.data;delete i[e],this.data=i}clear(){this.data={}}destroy(){this._store.removeItem(this._bucket)}popItem(e){let i=this.data,s=i[e];return delete i[e],this.data=i,s}};var Es="dfd-animate",ws="dfd-fixed-layout",Me="hidden",yi="floating",Si="fullscreen",tt="static";function Ei(t){let e=["left","top","right","bottom","width","height","scrollLeft","scrollTop","scrollWidth","scrollHeight"],i=e.reduce((r,n)=>(r[n]=0,r),{}),s=t;if(s===window)i=Ce(O({},i),{width:s.outerWidth,height:s.outerHeight,clientWidth:s.innerWidth,clientHeight:s.innerHeight,scrollLeft:s.scrollX,scrollTop:s.scrollY,scrollWidth:document.scrollWidth,scrollHeight:document.scrollHeight});else{if(s===document)s=document.documentElement,i=Ce(O({},i),{width:s.offsetWidth,height:s.offsetHeight});else if(s.getBoundingClientRect){let r=s.getBoundingClientRect();i=e.reduce((n,o)=>(n[o]=r[o],n),{})}i=Ce(O({},i),{clientWidth:s.clientWidth,clientHeight:s.clientHeight,scrollLeft:s.scrollLeft,scrollTop:s.scrollTop,scrollWidth:s.scrollWidth,scrollHeight:s.scrollHeight})}return i}function Jr(t){let e=t;for(;e&&getComputedStyle(e).position!=="fixed";)e=e.offsetParent;return!!e}"use strict";var As=class{constructor(e,i={}){this.options=O({align:i.align,offsetX:0,offsetY:4,marginY:20,marginX:20,fillViewPortWidth:768},i),this.element=e}__origin__(e){let i=Ei(e),s=Ei(document),r=s.width<=this.options.fillViewPortWidth,n={width:i.width,top:i.top+i.height,left:i.left,fixed:Jr(e),align:function(){let o=Math.abs(i.left)*100/s.width,a=Math.abs(s.clientWidth-i.right)*100/s.width;switch(!0){case r:case Math.abs(o-a)<=15:return"center";case on-a&&(this.element.style.height=`${n-a}px`):this.element.style.height=`${n-a}px`}destroy(){["position","top","left","right","height","maxWidth","marginLeft"].forEach(e=>this.element.style[e]=null),this.options=null,this.element=null}};function wi(t,e=66,i=!1){let s;return function(...r){s?Date.now()-s>=e?(t(...r),s=Date.now()):i&&console.log("throttle: discard execution"):(t(...r),s=Date.now())}}var it=class{constructor(e){this.mount=e,this._positionReference=null}__animate__(){return new Promise(e=>{setTimeout(()=>{this.mount.classList.add(Es),e()},10)})}get positionReference(){return this._positionReference}show(){return P(this,null,function*(){let e=this.hidden();return e&&(this.mount.removeAttribute(Me),yield this.__animate__()),e})}hide(){return P(this,null,function*(){let e=!this.hidden();return e&&(this.mount.setAttribute(Me,""),this.mount.classList.remove(Es),this.mount.innerHTML=""),e})}updatePosition(e){return P(this,null,function*(){this._positionReference=e.positionReference})}destroy(){this.mount=void 0}hidden(){return this.mount.hasAttribute(Me)}};var Ts=class extends it{constructor(e,i={}){super(e);this.handleWindowChange=wi(this.handleWindowChange.bind(this)),this._position=new As(this.mount,i)}__addListeners__(){window.addEventListener("resize",this.handleWindowChange,{passive:!0})}__removeListeners__(){window.removeEventListener("resize",this.handleWindowChange)}get position(){return this._position}handleWindowChange(){this._position.update(this._positionReference)}show(){var e=i=>super[i];return P(this,null,function*(){let s=this.hidden();return s&&(this.mount.style.opacity="0",this.mount.removeAttribute(Me)),this._position.update(this._positionReference),s&&(this.mount.setAttribute(Me,""),this.mount.style.opacity=null,yield e("show").call(this),this.__addListeners__()),s})}hide(){var e=i=>super[i];return P(this,null,function*(){let s=!this.hidden();return s&&(this.__removeListeners__(),yield e("hide").call(this)),s})}updatePosition(e){var i=s=>super[s];return P(this,null,function*(){i("updatePosition").call(this,e),setTimeout(()=>{this._position.update(this._positionReference)},100)})}destroy(){this.__removeListeners__(),this._position.destroy(),this._position=null,super.destroy()}};var xs=class extends it{show(){var e=i=>super[i];return P(this,null,function*(){let s=this.hidden();return s&&(document.documentElement.classList.add(ws),yield e("show").call(this)),s})}hide(){var e=i=>super[i];return P(this,null,function*(){let s=yield e("hide").call(this);return s&&document.documentElement.classList.remove(ws),s})}};function Ai(t=8){let e="";for(;e.length{let n=0,o=null,a=e.interval||Vo,l=e.times||Bo;o=setInterval(function(){n++this.off(e,i)}once(e,i){if(this._checkReady())return this.el.addEventListener(e,i,{once:!0,passive:!0}),()=>this.off(e,i)}off(e,i){this._checkReady()&&this.el.removeEventListener(e,i)}emit(e,i){if(this._checkReady()){let s=new CustomEvent(e,{detail:i,bubbles:!1,cancelable:!1,composed:!1});this.el.dispatchEvent(s)}}teardown(){this._checkReady()&&(this.el=this.el.remove())}_checkReady(){if(this.el)return!0;throw new Error("tried to access a dead event bus!")}};var Is="__DF_DEBUG_MODE__",qr="true",Pi=window.sessionStorage;function Wr(){Pi.setItem(Is,qr)}function Kr(){Pi.removeItem(Is)}function zr(){return Pi.getItem(Is)===qr}function Ls(t){return Pi.getItem(t)||window[t]}function H(...t){zr()&&console.log("[doofinder]",...t)}var Gr=function(t){let e=t.slice(0,4);return RegExp(`#${e}/(brand-categories|classic|classic-initial|embedded|fullscreen|fullscreen-brand-categories|fullscreen-initial|mobile|mobile-brand-categories|mobile-initial)/`)},Yr=function(t){let e=t.slice(0,4);return RegExp(`#${e}/(category-pages|mobile-category-pages)/`)};"use strict";var Ne=window.history,Ri=class{constructor({installationId:e,autoload:i,urlHash:s,layerType:r}){this._installationId=e,this._layerType=r,this._autoload=i?Object.freeze(i):null,this._urlHash=s,this._storage=new vt(`${e}.data`,window.sessionStorage),this.__initialSetup__()}get hasAutoloadQueryParam(){return this.__getQueryFromAutoload__()!==null}get isTransitory(){return this._isTransitory}get query(){return this.__getQuery__()}get targetItemId(){return this._targetItemId}get value(){return this._value}set targetItemId(e){this._targetItemId=e}saveTransitory(e){if(!this.__valid__(this._value)){H(`[state] [${this._layerType}] saveTransitory: not valid for `,this._value);return}H(`[state] [${this._layerType}] saveTransitory:`,this._value),this._storage.setItem(this.__getStateKey__(),{value:this.__simplify__(this._value),location:e})}update(e,i,s){if(!this.__hasChanged__(e,i,s))return H(`[state] [${this._layerType}] update not performed, the state has not changed.`,e,i,s),!1;this.__valid__(e)&&(H(`[state] [${this._layerType}] new state value: `,e),this._value=e),this._targetItemId=i,this._isTransitory=s;let r=window.location.origin+window.location.pathname+window.location.search;this._urlHash&&(r=r+this._value),H(`[state] [${this._layerType}] replaceState:`,r),Ne.replaceState(this.__getNewStateObject__(),"",r)}__hasChanged__(e,i,s){return e!=this._value||i!=this._targetItemId||s!=this._isTransitory}__initialSetup__(){let e=this.__fromHistory__(),i=this.__fromStorage__(),s=e||i||this.__fromHash__()||this.__fromAutoload__()||"";s=s.match("^#([A-Za-z0-9-]+)/(embedded|classic)/$")?"":s,this._value=s,this._targetItemId=this.__getTargetItem__(),this._isTransitory=this.__isTransitory__(!!i),i&&Ne.replaceState(this.__getNewStateObject__(),"",window.location.href)}__fromAutoload__(){if(!this._autoload)return H(`[state] [${this._layerType}] __fromAutoload__ with autoload false - state:`,null),null;let e=this.__getQueryFromAutoload__(),i=e!=null?`#/${this._autoload.screen}/q=${e.trim()}`:null;return H(`[state] [${this._layerType}] __fromAutoload__ (query) state:`,i),i}__fromHash__(){let e=this.__validHash__(window.location.hash)?`#${window.location.hash.split("#",2)[1]}`:null;return H(`[state] [${this._layerType}] __fromHash__ state:`,e),e}__fromHistory__(){let e=null;return this.__validDoofinderStateInHistory__()&&(e=Ne.state[this.__getStateKey__()].value),H(`[state] [${this._layerType}] __fromHistory__ state:`,e),e}__fromStorage__(){let e=this._storage.popItem(this.__getStateKey__());return!!e&&!window.location.href.includes(e.location)?(H(`[state] [${this._layerType}] __fromStorage__ discarded as it is from diferent location:`,e),null):(H(`[state] [${this._layerType}] __fromStorage__ state:`,e),!!e&&e.value)}__getNewStateObject__(){let e={[this.__getStateKey__()]:{value:this._value,transitory:this._isTransitory,targetItemId:this._targetItemId}};return H(`[state] [${this._layerType}] __getNewStateObject__:`,e),this.__validHistoryState__()?O(O({},Ne.state),e):e}__getQuery__(){if(this._value){let e=this._value.split("/"),i=e[e.length-1];return Object.fromEntries(new URLSearchParams(i)).q}return""}__getQueryFromAutoload__(){return this._autoload?new URLSearchParams(window.location.search).get(this._autoload.param):null}__getTargetItem__(){let e=null;return this.__validDoofinderStateInHistory__()&&(e=Ne.state[this.__getStateKey__()].targetItemId),H(`[state] [${this._layerType}] __getTargetItem__:`,e),e}__getStateKey__(){return this._layerType=="category_pages"?Ri.CP_STATE_KEY:Ri.STATE_KEY}__isTransitory__(e){let i=e;return this.__validDoofinderStateInHistory__()&&(i=Ne.state[this.__getStateKey__()].transitory),H(`[state] [${this._layerType}] __isTransitory__:`,i),i}__simplify__(e){let s=new URL(window.location.origin+window.location.pathname+window.location.search+e).hash.split("/"),r=new URLSearchParams(s.pop());return r.get("q")?`${s.join("/")}/m=${r.get("m")}&q=${r.get("q")}`:""}__valid__(e){return this.__validHash__(e)||e===""}__validHistoryState__(){return typeof Ne.state=="object"&&Ne.state!==null}__validDoofinderStateInHistory__(){return this.__validHistoryState__()&&Ne.state[this.__getStateKey__()]!=null}__validHash__(e){let i=this._layerType!=="category_pages"?Gr(this._installationId):Yr(this._installationId);return typeof e=="string"&&(i.test(e)||e.startsWith(`#/${this._installationId}/`))}},st=Ri;ts(st,"STATE_KEY","dfState"),ts(st,"CP_STATE_KEY","dfCpState");var Ds="df:trigger:click",Nt="df:trigger:focus",Ft="df:trigger:input",Os="df:trigger:submit";var rt=1;"use strict";var Xo="[dfd-carousel-btn-left]",Jo="[dfd-carousel-btn-right]",Qr="[dfd-carousel-content]",Ii="ltr",Zr={mounted(){this.btnLeftEl=this.el.querySelector(Xo),this.btnRightEl=this.el.querySelector(Jo),this.contentEl=this.el.querySelector(Qr),getComputedStyle(this.contentEl).direction==="rtl"&&(Ii="rtl"),this.getVisibleChildren=()=>{let t=this.contentEl.getBoundingClientRect();return Array.from(this.contentEl.children).filter(e=>{let i=e.getBoundingClientRect();return t.left<=i.left&&t.right>=i.right})},this.nextPage=()=>{let t=this.getVisibleChildren();if(t.length<=0)return;let e=t.slice(-1).pop(),i=e.nextElementSibling;if(!i)return;let s=this.contentEl.getBoundingClientRect(),r=e.getBoundingClientRect(),n=i.getBoundingClientRect(),o=r.width,a=i?n.x-r.x-r.width:0,l;Ii==="ltr"?l=this.contentEl.scrollLeft+(r.x-s.x):l=this.contentEl.scrollLeft-(r.x+s.x),this.contentEl.scroll({left:l+o+a/2,behavior:"smooth"})},this.previousPage=()=>{let t=this.getVisibleChildren();if(t.length<=0)return;let e=t[0],i=e.previousElementSibling;if(!i)return;let s=this.contentEl.getBoundingClientRect(),r=e.getBoundingClientRect(),n=i.getBoundingClientRect(),o=n.width-(s.x-n.x),a=i?r.x-n.x-n.width:0,l;Ii==="ltr"?l=this.contentEl.scrollLeft-s.width:l=this.contentEl.scrollLeft+s.width,this.contentEl.scroll({left:l+o+a/2,behavior:"smooth"})},this.btnLeftEl.addEventListener("click",this.previousPage),this.btnRightEl.addEventListener("click",this.nextPage),this.tag.dispatch("doofinder.carousel.load")},updated(){this.contentEl=this.el.querySelector(Qr),getComputedStyle(this.contentEl).direction==="rtl"&&(Ii="rtl"),this.tag.dispatch("doofinder.carousel.update")},destroyed(){this.btnLeftEl.removeEventListener("click",this.previousPage),this.btnRightEl.removeEventListener("click",this.nextPage)}};var Li=240;function qo(t){return!!t.type.match(/image\/.*/)}function en(t){return P(this,null,function*(){if(!qo(t))throw"invalid image, can't search";let e=yield tn(t),i=yield Wo(e);return yield tn(i)})}function tn(t){return new Promise(function(e,i){let s=new FileReader;s.onload=function(){e(s.result)},s.onerror=function(){i(s.error)},s.readAsDataURL(t)})}function Wo(t){return new Promise(function(e,i){let s=new Image;s.onload=function(){let r=document.createElement("canvas");r.width=Li,r.height=Li,r.getContext("2d").drawImage(s,0,0,Li,Li),r.toBlob(function(n){e(n)},"image/jpeg")},s.onerror=function(r){i("resize image error")},s.src=t})}var sn={mounted(){this.search=t=>P(this,null,function*(){this.el.dataset.status="loading";let e=yield en(t);this.pushEvent("search",{search:{image:e}})}),this.el.addEventListener("change",t=>this.search(t.target.files[0]))}};function Hs(t){setTimeout(()=>{t.focus()},0)}function rn(t){setTimeout(()=>{t.select()},0)}"use strict";var nn={mounted(){rn(this.el),this.search=t=>{let e=this.el.dataset.dfdAction||"search";this.pushEvent(e,{search:{query:t}})},this.handleEvent("set-input-value",t=>this.el.value=t.query),this.handleEvent("set-input-focus",()=>Hs(this.el)),this.handleEvent("unset-input-focus",()=>{setTimeout(()=>{var t;(t=document.activeElement)==null||t.blur()},0)}),this.el.addEventListener("input",()=>this.search(this.el.value)),this.el.addEventListener("keydown",t=>{let e=this.el.getAttribute("dfd-value-suggestion");t.key==="Tab"&&e&&e!==this.el.value&&(this.el.value=e,Hs(this.el),this.search(e))})}};"use strict";var on={mounted(){let t={add_to_cart:e=>()=>{let i=JSON.parse(e.dataset.item);if(this.el.querySelectorAll("[data-role=variant_selected][value='']").length>0){let s=this.el.querySelector("[data-role=variant_selected][value='']").dataset.variant,r=this.evaluate_filters(s);this.pushEvent("get-variants",{item:i,filters:r},()=>{this.execJS(`[data-role=selector][data-variant="${s}"]`,"show")})}else this.el.dataset.quantity=="true"&&this.el.dataset.status=="initial"?(this.execJS(null,"set_attr",["data-status","quantity"]),this.execJS("[data-role=decrease_quantity]","hide"),this.execJS("[data-role=delete_quantity]","show"),this.execJS("[data-role=amount_selected]","set_attr",["value","1"])):(this.send(i),this.execJS(null,"set_attr",["data-status","initial"]),this.execJS("[data-role=amount_selected]","set_attr",["value",1]),this.el.querySelector("[data-role=select_variant].selected")&&this.execJS("[data-role=select_variant].selected","remove_class","selected"),this.el.querySelectorAll("[data-role=open_selector]").forEach(r=>{this.execJS(`[data-role=open_selector][data-variant="${r.dataset.variant}"] input`,"set_attr",["value",r.dataset.variant])}),this.el.querySelectorAll("[data-role=open_selector]").forEach(r=>{this.execJS(`[data-role=variant_selected][data-variant="${r.dataset.variant}"]`,"remove_attr","data-index"),this.execJS(`[data-role=variant_selected][data-variant="${r.dataset.variant}"]`,"set_attr",["value",""])}))},increase_quantity:e=>()=>{let i=this.el.querySelector("[data-role=amount_selected]"),s=parseInt(i.value)+1;this.update_quantity(i,s)},decrease_quantity:e=>()=>{let i=this.el.querySelector("[data-role=amount_selected]"),s=parseInt(i.value)-1;this.update_quantity(i,s)},delete_quantity:e=>()=>{this.execJS(null,"set_attr",["data-status","initial"])},open_selector:e=>()=>{if(!e.dataset.item){this.execJS(`[data-role=selector][data-variant="${e.dataset.variant}"]`,"show");return}let i=this.evaluate_filters(e.dataset.variant),s=JSON.parse(e.dataset.item);this.pushEvent("get-variants",{item:s,filters:i},()=>{this.execJS(`[data-role=selector][data-variant="${e.dataset.variant}"]`,"show")})},select_variant:e=>()=>{let i=e.closest("[data-role=selector]").dataset.variant;this.el.querySelector("[data-role=select_variant].selected")&&this.execJS("[data-role=select_variant].selected","remove_class","selected"),this.execJS(`[data-role=selector][data-variant="${i}"]`,"hide"),this.execJS(`[data-role=selector][data-variant="${i}"] [data-id="${e.dataset.id}"]`,"add_class","selected"),this.execJS(`[data-role=open_selector][data-variant="${i}] input`,"set_attr",["value",e.dataset.val]),this.execJS(`[data-role=variant_selected][data-variant="${i}"]`,"set_attr",["value",e.dataset.val]),this.restore_filters(i),this.execJS(null,"set_attr",["data-status","initial"])},close_selector:e=>()=>{let i=e.closest("[data-role=selector]").dataset.variant;this.execJS(`[data-role=selector][data-variant="${i}"]`,"hide"),this.execJS(null,"set_attr",["data-status","initial"])},send:e=>()=>{let i=Array.from(this.el.querySelectorAll("[data-role=variant_selected]")).map(n=>n.value),s=this.el.querySelector("[data-role=amount_selected]").value,r=JSON.parse(e.dataset.item);s&&!i.includes("")?this.send(r):alert("Falta alg\xFAn dato")}};this.el.addEventListener("click",e=>{if(e.target.closest("[data-role]")){let i=Object.keys(t).find(s=>e.target.closest("[data-role]").dataset.role.match(s));i&&t[i](e.target.closest("[data-role]"))()}}),this.el.addEventListener("input",e=>{let i=e.target.closest("[data-role=amount_selected]");i&&i.value!=""&&this.update_quantity(i,parseInt(i.value))}),this.execJS=(e,i,s)=>{let r=this.el.querySelector(e);e==null&&(r=this.el),r!=null&&(i=="set_attr"?this.liveSocket.execJS(r,'[["'+i+'",{"to": null, "attr":["'+s[0]+'","'+s[1]+'"]}]]'):i=="remove_class"||i=="add_class"?this.liveSocket.execJS(r,'[["'+i+'",{"to": null, "time":200,"names":["'+s+'"],"transition":[[],[],[]]}]]'):this.liveSocket.execJS(r,'[["'+i+'",{"to": null}]]'))},this.update_quantity=(e,i)=>{this.execJS("[data-role=amount_selected]","set_attr",["value",parseInt(i)]),e.value=i,this.evaluate_quantity(i)},this.evaluate_quantity=e=>{e<=1?(this.execJS("[data-role=decrease_quantity]","hide"),this.execJS("[data-role=delete_quantity]","show"),this.execJS("[data-role=increase_quantity]","show")):(this.execJS("[data-role=decrease_quantity]","show"),this.execJS("[data-role=delete_quantity]","hide"),this.execJS("[data-role=increase_quantity]","show"))},this.evaluate_filters=e=>{let i=this.el.querySelector(`[data-role=variant_selected][data-variant="${e}"]`).dataset.index;return Array.from(this.el.querySelectorAll("[data-role=variant_selected][data-index]")).filter(s=>i==null||parseInt(s.dataset.index)({key:s.dataset.variant,value:s.value}))},this.restore_filters=e=>{let i=this.el.querySelector(`[data-role=variant_selected][data-variant="${e}"]`).dataset.index,s=this.el.querySelectorAll("[data-role=variant_selected][data-index]").length;i===void 0&&this.execJS(`[data-role=variant_selected][data-variant="${e}"]`,"set_attr",["data-index",s+1]);for(let r=parseInt(i)+1;r<=s;r++){let n=this.el.querySelector(`[data-role=variant_selected][data-index="${r}"]`).dataset.variant;this.execJS(`[data-role=variant_selected][data-variant="${n}"]`,"set_attr",["value",""]),this.execJS(`[data-role=variant_selected][data-variant="${n}]`,"remove_attr","data-index"),this.execJS(`[data-role=open_selector][data-variant="${n}"] input`,"set_attr",["value",n])}},this.send=e=>{let i=Array.from(this.el.querySelectorAll("[data-role=variant_selected][data-index]")).map(r=>({key:r.dataset.variant,value:r.value})),s=this.el.querySelector("[data-role=amount_selected]").value;this.start_add_to_cart(),this.pushEvent("add-to-cart-beta",{item:e,amount:s,filters:i},r=>{r.statusPromise=new De({resolveTimeout:3e3,rejectTimeout:5e3}),r.statusPromise.then(this.finish_add_to_cart,this.finish_add_to_cart),document.dispatchEvent(new CustomEvent("doofinder.cart.add",{detail:r}))})},this.start_add_to_cart=()=>{this.execJS(".dfd-cart-check-button[data-role=add_to_cart]","add_class","dfd-btn-loading"),this.execJS(".dfd-cart-add-button [data-role=add_to_cart]","add_class","dfd-btn-loading")},this.finish_add_to_cart=e=>{this.execJS(".dfd-cart-check-button[data-role=add_to_cart]","remove_class","dfd-btn-loading"),this.execJS(".dfd-cart-add-button [data-role=add_to_cart]","remove_class","dfd-btn-loading"),this.execJS(".dfd-cart-check-button[data-role=add_to_cart]","add_class","dfd-btn-done"),this.execJS(".dfd-cart-add-button [data-role=add_to_cart]","add_class","dfd-btn-done"),setTimeout(()=>{this.execJS(".dfd-cart-check-button[data-role=add_to_cart]","remove_class","dfd-btn-done"),this.execJS(".dfd-cart-add-button [data-role=add_to_cart]","remove_class","dfd-btn-done")},500),typeof e=="function"&&e()}}};function nt(t){return`${$}:${t}`}"use strict";var Di="doofinder.cart.add.click",Ko="doofinder.cart.add",Oi="doofinder.cart.hide.price",Hi="doofinder.cart.display.price",Ms="dfd-btn-loading",an="dfd-btn-done",ln="dfd-btn-error";function hn(t){t.addToCartResolveTimeout=3e3,t.addToCartRejectTimeout=5e3,t.addToCartButtonFeedback=function(i,s){let r=zo.bind(null,i,s),n=Qo.bind(null,i,i.innerHTML),o=Go.bind(null,i,n),a=Yo.bind(null,i,n);r().then(o,a)},t.handleCartAddClick=i=>{let s=i.detail.target?document.getElementById(i.detail.target.id):i.target,r=new De({resolveTimeout:t.addToCartResolveTimeout,rejectTimeout:t.addToCartRejectTimeout});r.then(n=>{t.pushEvent("add-to-cart",{item:i.detail.item,dfid:i.detail.dfid},()=>{typeof n=="function"&&n()}),t.pushEvent("close-add-to-cart-button",{item:i.detail.item,dfid:i.detail.dfid})},n=>{typeof n=="function"&&n(),t.pushEvent("close-add-to-cart-button",{item:i.detail.item,dfid:i.detail.dfid})}),setTimeout(()=>t.tag.dispatch(Ko,Ce(O({},i.detail.item),{statusPromise:r})),1e3),t.addToCartButtonFeedback&&t.addToCartButtonFeedback(s,r)},t.handleHidePrice=i=>{let s=i.detail.target?document.getElementById(i.detail.target.id):i.target;s.closest(".dfd-card-row").querySelector(".dfd-card-pricing").style.display="none"},t.handleDisplayPrice=i=>{let s=i.detail.target?document.getElementById(i.detail.target.id):i.target;s.closest(".dfd-card-row").querySelector(".dfd-card-pricing").style.display="flex"};let e=!!t.tag&&!!t.tag.dom?t.tag.dom.mount:t.tag.mount;e.addEventListener(Di,t.handleCartAddClick),e.addEventListener(nt(Di),t.handleCartAddClick),e.addEventListener(Oi,t.handleHidePrice),e.addEventListener(nt(Oi),t.handleHidePrice),e.addEventListener(Hi,t.handleDisplayPrice),e.addEventListener(nt(Hi),t.handleDisplayPrice)}function cn(t){let e=!!t.tag&&!!t.tag.dom?t.tag.dom.mount:t.tag.mount;e.removeEventListener(Di,t.handleCartAddClick),e.removeEventListener(nt(Di),t.handleCartAddClick),e.removeEventListener(Oi,t.handleHidePrice),e.removeEventListener(nt(Oi),t.handleHidePrice),e.removeEventListener(Hi,t.handleDisplayPrice),e.removeEventListener(nt(Hi),t.handleDisplayPrice)}function zo(t,e){return t.setAttribute("disabled",""),t.setAttribute("dfd-update","ignore"),t.innerHTML="",t.classList.add(Ms),e}function Go(t,e){t.classList.remove(Ms),t.classList.add(an),setTimeout(e,1e3)}function Yo(t,e){t.classList.remove(Ms),t.classList.add(ln),setTimeout(e,2e3)}function Qo(t,e){t.classList.remove(an),t.classList.remove(ln),t.innerHTML=e,t.removeAttribute("dfd-update"),t.removeAttribute("disabled")}"use strict";var dn={mounted(){this.close=()=>this.pushEvent("close-layer"),this.handleEvent("close",()=>{this.tag.disconnect()}),this.handleEvent("change-state",({state:t})=>{this.tag.updateState({value:t})}),this.handleEvent("disconnect",t=>{t.errors.forEach(e=>console.error("[Doofinder] error:",e)),this.tag.destroy()}),this.handleEvent("load",t=>{this.tag.onLoad(t),this.tag.dispatch("doofinder.layer.load",{display_type:t.display_type}),this.pushEvent("ready")}),this.handleEvent("click-suggestion",t=>P(this,null,function*(){var e;this.tag.trigger.updateQuery((e=t==null?void 0:t.search)==null?void 0:e.query)})),this.handleEvent("set-trigger-focus",()=>P(this,null,function*(){this.tag.trigger.focus()})),this.handleEvent("search",t=>{this.tag.dispatch("doofinder.layer.search",t)}),this.handleEvent("item-click",t=>{this.tag.dispatch("doofinder.layer.itemClick",t)}),this.handleEvent("update-latest-searches",({entries:t})=>{this.tag.updateLatestSearches(t)}),this.el.addEventListener("contextmenu",t=>{let e=t.target.closest('[dfd-click="item-click"]');if(e){let i=e.getAttribute("dfd-value-link"),s=e.getAttribute("dfd-value-dfid");this.pushEvent("item-click",{link:i,dfid:s},()=>{this.debug(`item-click sent for ${s} to ${i}`)})}}),this.el.addEventListener("error",({target:t})=>{if(t.tagName!=="IMG")return;let e=t.closest('[data-dfd-role="card-thumbnail"]');setTimeout(()=>{e==null||e.parentElement.setAttribute("dfd-update","ignore"),e==null||e.classList.add("dfd-card-thumbnail-404")},1)},!0),this.applyOperationBySelector=function(t,e){if(t.startsWith("#")){let i=document.getElementById(t);e(i)}else this.el.querySelectorAll(t).forEach(i=>{e(i)})},this.handleEvent("dom:add-class",({target:t,newClass:e})=>{this.applyOperationBySelector(t.selector,i=>i==null?void 0:i.classList.add(e))}),this.handleEvent("dom:remove-class",({target:t,oldClass:e})=>{this.applyOperationBySelector(t.selector,i=>i==null?void 0:i.classList.remove(e))}),this.handleEvent("dom:add-attribute",({target:t,name:e,value:i})=>{this.applyOperationBySelector(t.selector,s=>s==null?void 0:s.setAttribute(e,i))}),this.handleEvent("dom:remove-attribute",({target:t,name:e})=>{this.applyOperationBySelector(t.selector,i=>i==null?void 0:i.removeAttribute(e))}),this.handleEvent("redirection:update",({redirection:t})=>{this.tag.trigger.redirection=t}),hn(this)},updated(){this.tag.dispatch("doofinder.layer.update")},destroyed(){cn(this)}},un={mounted(){this.handleEvent("disconnect",t=>{t.errors.forEach(e=>console.error("[Doofinder] error:",e)),this.tag.destroy()})}};var fn=Object.freeze({Linear:function(t){return t},EaseInQuad:function(t){return t*t},EaseOutQuad:function(t){return t*(2-t)},EaseInOutQuad:function(t){return t<.5?2*t*t:-1+(4-2*t)*t},EaseInCubic:function(t){return t*t*t},EaseOutCubic:function(t){return--t*t*t+1},EaseInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},EaseInQuart:function(t){return t*t*t*t},EaseOutQuart:function(t){return 1- --t*t*t*t},EaseInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},EaseInQuint:function(t){return t*t*t*t*t},EaseOutQuint:function(t){return 1+--t*t*t*t*t},EaseInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}});function pn(t,e,i,s,r=fn.EaseInQuint){let n=Date.now(),o=e[t];return new Promise((a,l)=>{function c(){let f=Date.now(),m=Math.min(1,(f-n)/s),v=r(m);e[t]=o+v*(i-o),m<1?requestAnimationFrame(c):a()}o===i?a():requestAnimationFrame(c)})}var mn=pn.bind(null,"scrollTop"),kc=pn.bind(null,"scrollLeft");function Zo(t){let e=t.scrollHeight>t.clientHeight,s=window.getComputedStyle(t).overflowY.indexOf("hidden")!==-1;return e&&!s}function Mi(t){return!t||t===document.documentElement?document.documentElement:Zo(t)?t:Mi(t.parentNode)}function gn(t,e){return typeof t!="undefined"?t:e}var $t=class{constructor(e,i,s={}){let{threshold:r}=s;this.handleIntersection=this.handleIntersection.bind(this),this._callback=i,this._io=new IntersectionObserver(this.handleIntersection,{root:e,threshold:gn(r,0)})}observe(e){this._io.disconnect(),e&&this._io.observe(e),H("[ScrollObserver][observe]",e)}unobserve(){this._io.disconnect(),H("[ScrollObserver][unobserve]")}handleIntersection([e]){H("[ScrollObserver][intersection detected] target:",e.target),this._callback(e)}};var _n='[data-dfd-role~="scroll-sentinel"]',vn='[data-dfd-role~="scroll-top-sentinel"]',ea="div.dfd-card";function Ut(t,e,i){i?t.scrollTop=e:mn(t,e,250)}function ta(t){var s,r;let e=((s=document.querySelector(ea))==null?void 0:s.offsetHeight)||0,i=((r=document.querySelector(_n))==null?void 0:r.offsetHeight)||0;return t.scrollHeight-i-e*2.6}var bn={mounted(){this.sentinel=()=>this.el.querySelector(_n),this.scrollTopSentinel=()=>this.el.querySelector(vn),this.scrollTarget=()=>this.el.dataset.dfdScrollTarget,this.refreshObservers=()=>{this.scrollObserver.observe(this.sentinel()),this.scrollTopObserver.observe(this.scrollTopSentinel())},this.changeBackToTopVisibility=t=>{this.pushEvent("change-back-to-top-visibility",{visible:t})},this.scrollObserver=new $t(this.el,({target:t,isIntersecting:e})=>{if(!e)return;let i={index:t.dataset.index};this.debug('[push] "load-more", params:',i),this.pushEvent("load-more",i)}),this.scrollTopObserver=new $t(this.el,({isIntersecting:t})=>{this.changeBackToTopVisibility(!t)}),this.handleEvent("search",t=>{this.debug('[handle] "search", params:',t);let{index:e,page:i}=t,s=this.sentinel();!ia(t.filter)&&i===1&&e===(s==null?void 0:s.dataset.index)&&(this.changeBackToTopVisibility(!1),Ut(this.el,0,!0)),this.refreshObservers()}),this.handleEvent("back-to-top",({id:t,fast:e})=>{this.debug(`[handle] "back-to-top", id: ${t}, fast: ${e}`),this.scrollTarget()==="window"?window.scrollTo(0,0):(!t||t===this.el.id)&&Ut(this.el,0,!!e)}),this.handleEvent("change-current-index",()=>{this.scrollObserver.observe(this.sentinel()),this.scrollTopObserver.observe(this.scrollTopSentinel()),Ut(this.el,0,!0)}),this.scrollObserver.observe(this.sentinel()),this.scrollTopObserver.observe(this.scrollTopSentinel())},destroyed(){this.scrollObserver.unobserve(),this.scrollObserver=null,this.scrollTopObserver.unobserve(),this.scrollTopObserver=null}},Ns={mounted(){this.hideVirtualKeyboard=wi(()=>{let t=document.querySelector("input:focus");t?(this.debug("[hideVirtualKeyboard][blur] input:",t),t.blur()):this.debug("[hideVirtualKeyboard][noop]")},100),this.debug("[observe][touchstart] hideVirtualKeyboard()"),this.el.addEventListener("touchstart",this.hideVirtualKeyboard)},destroyed(){this.debug("[unobserve][touchstart] hideVirtualKeyboard()"),this.el.removeEventListener("touchstart",this.hideVirtualKeyboard)}},Fs={mounted(){this.scrollTarget=()=>this.el.dataset.dfdScrollTarget,this.scrollTopSentinel=()=>this.el.querySelector(vn),this.transientTargetCard=()=>this.el.querySelector(`[dfd-value-dfid="${this.tag.state.targetItemId}"]`),this.changeBackToTopVisibility=t=>{this.pushEvent("change-back-to-top-visibility",{visible:t})},this.scrollTopObserver=new $t(null,({isIntersecting:t})=>{this.changeBackToTopVisibility(!t)}),this.scrollTopObserver.observe(this.scrollTopSentinel()),this.handleEvent("update-scroll",t=>{setTimeout((()=>{let e=this.transientTargetCard();this.debug('[handle] "update-scroll"',"params:",t,"card:",e),this.tag.targetItemId=null,e!=null?e.scrollIntoView({behavior:"smooth",block:"nearest"}):t.scroll_end&&Ut(Mi(this.el),ta(this.el),!1)}).bind(this),1e3)}),this.handleEvent("back-to-top",({id:t,fast:e})=>{this.debug(`[handle] "back-to-top", id: ${t}, fast: ${e}`),this.scrollTarget()==="window"?window.scrollTo(0,0):(!t||t===this.el.id)&&Ut(Mi(this.el),0,e)})}};function ia(t){return!!t&&Object.keys(t).length>0}function Ni(t,e,i,s){return new Intl.NumberFormat(t,{style:"currency",maximumFractionDigits:parseInt(i,10),numberingSystem:s,currency:e})}function Fi(t,e,i){return new Intl.NumberFormat(t,{maximumFractionDigits:parseInt(e,10),numberingSystem:i})}var $s=class{constructor(e,i,s,r,n){this.template=e,this.symbol=i,this.thousand=s,this.decimal=r,this.precision=n}format(e){let i=e<0,s=Math.pow(10,this.precision),r=(Math.round(e*s)/s).toFixed(this.precision),n=`${parseInt(Math.abs(r||0).toFixed(this.precision),10)}`,o=n.length>3?n.length%3:0,a=r.split(".")[1],l=[];return o>0&&l.push(`${n.substring(0,o)}${this.thousand}`),l.push(n.substring(o).replace(/(\d{3})(?=\d)/g,"$1"+this.thousand)),this.precision>0&&parseInt(a,10)>0&&l.push(`${this.decimal}${a}`),l=this.template.replace(/%s/g,this.symbol).replace(/%v/g,l.join("")),i&&(l=`-${l}`),l}};"use strict";var je;(function(t){t.Range="range",t.Steps="steps",t.Positions="positions",t.Count="count",t.Values="values"})(je||(je={}));var he;(function(t){t[t.None=-1]="None",t[t.NoValue=0]="NoValue",t[t.LargeValue=1]="LargeValue",t[t.SmallValue=2]="SmallValue"})(he||(he={}));function sa(t){return $i(t)&&typeof t.from=="function"}function $i(t){return typeof t=="object"&&typeof t.to=="function"}function yn(t){t.parentElement.removeChild(t)}function Us(t){return t!=null}function Sn(t){t.preventDefault()}function ra(t){return t.filter(function(e){return this[e]?!1:this[e]=!0},{})}function na(t,e){return Math.round(t/e)*e}function oa(t,e){var i=t.getBoundingClientRect(),s=t.ownerDocument,r=s.documentElement,n=An(s);return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(n.x=0),e?i.top+n.y-r.clientTop:i.left+n.x-r.clientLeft}function Te(t){return typeof t=="number"&&!isNaN(t)&&isFinite(t)}function En(t,e,i){i>0&&(le(t,e),setTimeout(function(){Bi(t,e)},i))}function wn(t){return Math.max(Math.min(t,100),0)}function Ui(t){return Array.isArray(t)?t:[t]}function aa(t){t=String(t);var e=t.split(".");return e.length>1?e[1].length:0}function le(t,e){t.classList&&!/\s/.test(e)?t.classList.add(e):t.className+=" "+e}function Bi(t,e){t.classList&&!/\s/.test(e)?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}function la(t,e){return t.classList?t.classList.contains(e):new RegExp("\\b"+e+"\\b").test(t.className)}function An(t){var e=window.pageXOffset!==void 0,i=(t.compatMode||"")==="CSS1Compat",s=e?window.pageXOffset:i?t.documentElement.scrollLeft:t.body.scrollLeft,r=e?window.pageYOffset:i?t.documentElement.scrollTop:t.body.scrollTop;return{x:s,y:r}}function ha(){return window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"}}function ca(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e)}catch(i){}return t}function da(){return window.CSS&&CSS.supports&&CSS.supports("touch-action","none")}function Bs(t,e){return 100/(e-t)}function Vs(t,e,i){return e*100/(t[i+1]-t[i])}function ua(t,e){return Vs(t,t[0]<0?e+Math.abs(t[0]):e-t[0],0)}function fa(t,e){return e*(t[1]-t[0])/100+t[0]}function Bt(t,e){for(var i=1;t>=e[i];)i+=1;return i}function pa(t,e,i){if(i>=t.slice(-1)[0])return 100;var s=Bt(i,t),r=t[s-1],n=t[s],o=e[s-1],a=e[s];return o+ua([r,n],i)/Bs(o,a)}function ma(t,e,i){if(i>=100)return t.slice(-1)[0];var s=Bt(i,e),r=t[s-1],n=t[s],o=e[s-1],a=e[s];return fa([r,n],(i-o)*Bs(o,a))}function ga(t,e,i,s){if(s===100)return s;var r=Bt(s,t),n=t[r-1],o=t[r];return i?s-n>(o-n)/2?o:n:e[r-1]?t[r-1]+na(s-t[r-1],e[r-1]):s}var Tn=function(){function t(e,i,s){this.xPct=[],this.xVal=[],this.xSteps=[],this.xNumSteps=[],this.xHighestCompleteStep=[],this.xSteps=[s||!1],this.xNumSteps=[!1],this.snap=i;var r,n=[];for(Object.keys(e).forEach(function(o){n.push([Ui(e[o]),o])}),n.sort(function(o,a){return o[0][0]-a[0][0]}),r=0;rthis.xPct[r+1];)r++;else e===this.xPct[this.xPct.length-1]&&(r=this.xPct.length-2);!s&&e===this.xPct[r+1]&&r++,i===null&&(i=[]);var n,o=1,a=i[r],l=0,c=0,f=0,m=0;for(s?n=(e-this.xPct[r])/(this.xPct[r+1]-this.xPct[r]):n=(this.xPct[r+1]-e)/(this.xPct[r+1]-this.xPct[r]);a>0;)l=this.xPct[r+1+m]-this.xPct[r+m],i[r+m]*o+100-n*100>100?(c=l*n,o=(a-100*n)/i[r+m],n=1):(c=i[r+m]*l/100*o,o=0),s?(f=f-c,this.xPct.length+m>=1&&m--):(f=f+c,this.xPct.length-m>=1&&m++),a=i[r+m]*o;return e+f},t.prototype.toStepping=function(e){return e=pa(this.xVal,this.xPct,e),e},t.prototype.fromStepping=function(e){return ma(this.xVal,this.xPct,e)},t.prototype.getStep=function(e){return e=ga(this.xPct,this.xSteps,this.snap,e),e},t.prototype.getDefaultStep=function(e,i,s){var r=Bt(e,this.xPct);return(e===100||i&&e===this.xPct[r-1])&&(r=Math.max(r-1,1)),(this.xVal[r]-this.xVal[r-1])/s},t.prototype.getNearbySteps=function(e){var i=Bt(e,this.xPct);return{stepBefore:{startValue:this.xVal[i-2],step:this.xNumSteps[i-2],highestStep:this.xHighestCompleteStep[i-2]},thisStep:{startValue:this.xVal[i-1],step:this.xNumSteps[i-1],highestStep:this.xHighestCompleteStep[i-1]},stepAfter:{startValue:this.xVal[i],step:this.xNumSteps[i],highestStep:this.xHighestCompleteStep[i]}}},t.prototype.countStepDecimals=function(){var e=this.xNumSteps.map(aa);return Math.max.apply(null,e)},t.prototype.hasNoSize=function(){return this.xVal[0]===this.xVal[this.xVal.length-1]},t.prototype.convert=function(e){return this.getStep(this.toStepping(e))},t.prototype.handleEntryPoint=function(e,i){var s;if(e==="min"?s=0:e==="max"?s=100:s=parseFloat(e),!Te(s)||!Te(i[0]))throw new Error("noUiSlider: 'range' value isn't numeric.");this.xPct.push(s),this.xVal.push(i[0]);var r=Number(i[1]);s?this.xSteps.push(isNaN(r)?!1:r):isNaN(r)||(this.xSteps[0]=r),this.xHighestCompleteStep.push(0)},t.prototype.handleStepPoint=function(e,i){if(!!i){if(this.xVal[e]===this.xVal[e+1]){this.xSteps[e]=this.xHighestCompleteStep[e]=this.xVal[e];return}this.xSteps[e]=Vs([this.xVal[e],this.xVal[e+1]],i,0)/Bs(this.xPct[e],this.xPct[e+1]);var s=(this.xVal[e+1]-this.xVal[e])/this.xNumSteps[e],r=Math.ceil(Number(s.toFixed(3))-1),n=this.xVal[e]+this.xNumSteps[e]*r;this.xHighestCompleteStep[e]=n}},t}(),xn={to:function(t){return t===void 0?"":t.toFixed(2)},from:Number},Cn={target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",touchArea:"touch-area",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",connects:"connects",ltr:"ltr",rtl:"rtl",textDirectionLtr:"txt-dir-ltr",textDirectionRtl:"txt-dir-rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"},Xe={tooltips:".__tooltips",aria:".__aria"};function _a(t,e){if(!Te(e))throw new Error("noUiSlider: 'step' is not numeric.");t.singleStep=e}function va(t,e){if(!Te(e))throw new Error("noUiSlider: 'keyboardPageMultiplier' is not numeric.");t.keyboardPageMultiplier=e}function ba(t,e){if(!Te(e))throw new Error("noUiSlider: 'keyboardMultiplier' is not numeric.");t.keyboardMultiplier=e}function ya(t,e){if(!Te(e))throw new Error("noUiSlider: 'keyboardDefaultStep' is not numeric.");t.keyboardDefaultStep=e}function Sa(t,e){if(typeof e!="object"||Array.isArray(e))throw new Error("noUiSlider: 'range' is not an object.");if(e.min===void 0||e.max===void 0)throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'.");t.spectrum=new Tn(e,t.snap||!1,t.singleStep)}function Ea(t,e){if(e=Ui(e),!Array.isArray(e)||!e.length)throw new Error("noUiSlider: 'start' option is incorrect.");t.handles=e.length,t.start=e}function wa(t,e){if(typeof e!="boolean")throw new Error("noUiSlider: 'snap' option must be a boolean.");t.snap=e}function Aa(t,e){if(typeof e!="boolean")throw new Error("noUiSlider: 'animate' option must be a boolean.");t.animate=e}function Ta(t,e){if(typeof e!="number")throw new Error("noUiSlider: 'animationDuration' option must be a number.");t.animationDuration=e}function xa(t,e){var i=[!1],s;if(e==="lower"?e=[!0,!1]:e==="upper"&&(e=[!1,!0]),e===!0||e===!1){for(s=1;s1)throw new Error("noUiSlider: 'padding' option must not exceed 100% of the range.")}}function Ra(t,e){switch(e){case"ltr":t.dir=0;break;case"rtl":t.dir=1;break;default:throw new Error("noUiSlider: 'direction' option was not recognized.")}}function Ia(t,e){if(typeof e!="string")throw new Error("noUiSlider: 'behaviour' must be a string containing options.");var i=e.indexOf("tap")>=0,s=e.indexOf("drag")>=0,r=e.indexOf("fixed")>=0,n=e.indexOf("snap")>=0,o=e.indexOf("hover")>=0,a=e.indexOf("unconstrained")>=0,l=e.indexOf("drag-all")>=0,c=e.indexOf("smooth-steps")>=0;if(r){if(t.handles!==2)throw new Error("noUiSlider: 'fixed' behaviour must be used with 2 handles");kn(t,t.start[1]-t.start[0])}if(a&&(t.margin||t.limit))throw new Error("noUiSlider: 'unconstrained' behaviour cannot be used with margin or limit");t.events={tap:i||n,drag:s,dragAll:l,smoothSteps:c,fixed:r,snap:n,hover:o,unconstrained:a}}function La(t,e){if(e!==!1)if(e===!0||$i(e)){t.tooltips=[];for(var i=0;i= 2) required for mode 'count'.");for(var d=h.values-1,u=100/d,_=[];d--;)_[d]=d*u;return _.push(100),R(_,h.stepped)}return h.mode===je.Positions?R(h.values,h.stepped):h.mode===je.Values?h.stepped?h.values.map(function(S){return v.fromStepping(v.getStep(v.toStepping(S)))}):h.values:[]}function R(h,d){return h.map(function(u){return v.fromStepping(d?v.getStep(u):u)})}function U(h){function d(F,K){return Number((F+K).toFixed(7))}var u=J(h),_={},S=v.xVal[0],y=v.xVal[v.xVal.length-1],T=!1,A=!1,j=0;return u=ra(u.slice().sort(function(F,K){return F-K})),u[0]!==S&&(u.unshift(S),T=!0),u[u.length-1]!==y&&(u.push(y),A=!0),u.forEach(function(F,K){var z,M,Q,ne=F,te=u[K+1],se,Gi,Yi,Qi,er,Zi,tr,ir=h.mode===je.Steps;for(ir&&(z=v.xNumSteps[K]),z||(z=te-ne),te===void 0&&(te=ne),z=Math.max(z,1e-7),M=ne;M<=te;M=d(M,z)){for(se=v.toStepping(M),Gi=se-j,er=Gi/(h.density||1),Zi=Math.round(er),tr=Gi/Zi,Q=1;Q<=Zi;Q+=1)Yi=j+Q*tr,_[Yi.toFixed(5)]=[v.fromStepping(Yi),0];Qi=u.indexOf(M)>-1?he.LargeValue:ir?he.SmallValue:he.NoValue,!K&&T&&M!==te&&(Qi=0),M===te&&A||(_[se.toFixed(5)]=[M,Qi]),j=se}}),_}function Fe(h,d,u){var _,S,y=I.createElement("div"),T=(_={},_[he.None]="",_[he.NoValue]=e.cssClasses.valueNormal,_[he.LargeValue]=e.cssClasses.valueLarge,_[he.SmallValue]=e.cssClasses.valueSub,_),A=(S={},S[he.None]="",S[he.NoValue]=e.cssClasses.markerNormal,S[he.LargeValue]=e.cssClasses.markerLarge,S[he.SmallValue]=e.cssClasses.markerSub,S),j=[e.cssClasses.valueHorizontal,e.cssClasses.valueVertical],F=[e.cssClasses.markerHorizontal,e.cssClasses.markerVertical];le(y,e.cssClasses.pips),le(y,e.ort===0?e.cssClasses.pipsHorizontal:e.cssClasses.pipsVertical);function K(M,Q){var ne=Q===e.cssClasses.value,te=ne?j:F,se=ne?T:A;return Q+" "+te[e.ort]+" "+se[M]}function z(M,Q,ne){if(ne=d?d(Q,ne):ne,ne!==he.None){var te=W(y,!1);te.className=K(ne,e.cssClasses.marker),te.style[e.style]=M+"%",ne>he.NoValue&&(te=W(y,!1),te.className=K(ne,e.cssClasses.value),te.setAttribute("data-value",String(Q)),te.style[e.style]=M+"%",te.innerHTML=String(u.to(Q)))}}return Object.keys(h).forEach(function(M){z(M,h[M][0],h[M][1])}),y}function fe(){f&&(yn(f),f=null)}function xe(h){fe();var d=U(h),u=h.filter,_=h.format||{to:function(S){return String(Math.round(S))}};return f=o.appendChild(Fe(d,u,_)),f}function qe(){var h=a.getBoundingClientRect(),d="offset"+["Width","Height"][e.ort];return e.ort===0?h.width||a[d]:h.height||a[d]}function re(h,d,u,_){var S=function(T){var A=ot(T,_.pageOffset,_.target||d);if(!A||Y()&&!_.doNotReject||la(o,e.cssClasses.tap)&&!_.doNotReject||h===s.start&&A.buttons!==void 0&&A.buttons>1||_.hover&&A.buttons)return!1;n||A.preventDefault(),A.calcPoint=A.points[e.ort],u(A,_)},y=[];return h.split(" ").forEach(function(T){d.addEventListener(T,S,n?{passive:!0}:!1),y.push([T,S])}),y}function ot(h,d,u){var _=h.type.indexOf("touch")===0,S=h.type.indexOf("mouse")===0,y=h.type.indexOf("pointer")===0,T=0,A=0;if(h.type.indexOf("MSPointer")===0&&(y=!0),h.type==="mousedown"&&!h.buttons&&!h.touches)return!1;if(_){var j=function(z){var M=z.target;return M===u||u.contains(M)||h.composed&&h.composedPath().shift()===u};if(h.type==="touchstart"){var F=Array.prototype.filter.call(h.touches,j);if(F.length>1)return!1;T=F[0].pageX,A=F[0].pageY}else{var K=Array.prototype.find.call(h.changedTouches,j);if(!K)return!1;T=K.pageX,A=K.pageY}}return d=d||An(I),(S||y)&&(T=h.clientX+d.x,A=h.clientY+d.y),h.pageOffset=d,h.points=[T,A],h.cursor=S||y,h}function Se(h){var d=h-oa(a,e.ort),u=d*100/qe();return u=wn(u),e.dir?100-u:u}function St(h){var d=100,u=!1;return l.forEach(function(_,S){if(!ue(S)){var y=b[S],T=Math.abs(y-h),A=T===100&&d===100,j=Ty;(j||F||A)&&(u=S,d=T)}}),u}function jt(h,d){h.type==="mouseout"&&h.target.nodeName==="HTML"&&h.relatedTarget===null&&Ji(h,d)}function zn(h,d){if(navigator.appVersion.indexOf("MSIE 9")===-1&&h.buttons===0&&d.buttonsProperty!==0)return Ji(h,d);var u=(e.dir?-1:1)*(h.calcPoint-d.startCalcPoint),_=u*100/d.baseSize;Ks(u>0,_,d.locations,d.handleNumbers,d.connect)}function Ji(h,d){d.handle&&(Bi(d.handle,e.cssClasses.active),N-=1),d.listeners.forEach(function(u){B.removeEventListener(u[0],u[1])}),N===0&&(Bi(o,e.cssClasses.drag),zi(),h.cursor&&(q.style.cursor="",q.removeEventListener("selectstart",Sn))),e.events.smoothSteps&&(d.handleNumbers.forEach(function(u){We(u,b[u],!0,!0,!1,!1)}),d.handleNumbers.forEach(function(u){G("update",u)})),d.handleNumbers.forEach(function(u){G("change",u),G("set",u),G("end",u)})}function qi(h,d){if(!d.handleNumbers.some(ue)){var u;if(d.handleNumbers.length===1){var _=l[d.handleNumbers[0]];u=_.children[0],N+=1,le(u,e.cssClasses.active)}h.stopPropagation();var S=[],y=re(s.move,B,zn,{target:h.target,handle:u,connect:d.connect,listeners:S,startCalcPoint:h.calcPoint,baseSize:qe(),pageOffset:h.pageOffset,handleNumbers:d.handleNumbers,buttonsProperty:h.buttons,locations:b.slice()}),T=re(s.end,B,Ji,{target:h.target,handle:u,listeners:S,doNotReject:!0,handleNumbers:d.handleNumbers}),A=re("mouseout",B,jt,{target:h.target,handle:u,listeners:S,doNotReject:!0,handleNumbers:d.handleNumbers});S.push.apply(S,y.concat(T,A)),h.cursor&&(q.style.cursor=getComputedStyle(h.target).cursor,l.length>1&&le(o,e.cssClasses.drag),q.addEventListener("selectstart",Sn,!1)),d.handleNumbers.forEach(function(j){G("start",j)})}}function Gn(h){h.stopPropagation();var d=Se(h.calcPoint),u=St(d);u!==!1&&(e.events.snap||En(o,e.cssClasses.tap,e.animationDuration),We(u,d,!0,!0),zi(),G("slide",u,!0),G("update",u,!0),e.events.snap?qi(h,{handleNumbers:[u]}):(G("change",u,!0),G("set",u,!0)))}function Yn(h){var d=Se(h.calcPoint),u=v.getStep(d),_=v.fromStepping(u);Object.keys(L).forEach(function(S){S.split(".")[0]==="hover"&&L[S].forEach(function(y){y.call(qt,_)})})}function Qn(h,d){if(Y()||ue(d))return!1;var u=["Left","Right"],_=["Down","Up"],S=["PageDown","PageUp"],y=["Home","End"];e.dir&&!e.ort?u.reverse():e.ort&&!e.dir&&(_.reverse(),S.reverse());var T=h.key.replace("Arrow",""),A=T===S[0],j=T===S[1],F=T===_[0]||T===u[0]||A,K=T===_[1]||T===u[1]||j,z=T===y[0],M=T===y[1];if(!F&&!K&&!z&&!M)return!0;h.preventDefault();var Q;if(K||F){var ne=F?0:1,te=Zs(d),se=te[ne];if(se===null)return!1;se===!1&&(se=v.getDefaultStep(b[d],F,e.keyboardDefaultStep)),j||A?se*=e.keyboardPageMultiplier:se*=e.keyboardMultiplier,se=Math.max(se,1e-7),se=(F?-1:1)*se,Q=E[d]+se}else M?Q=e.spectrum.xVal[e.spectrum.xVal.length-1]:Q=e.spectrum.xVal[0];return We(d,v.toStepping(Q),!0,!0),G("slide",d),G("update",d),G("change",d),G("set",d),!1}function Zn(h){h.fixed||l.forEach(function(d,u){re(s.start,d.children[0],qi,{handleNumbers:[u]})}),h.tap&&re(s.start,a,Gn,{}),h.hover&&re(s.move,a,Yn,{hover:!0}),h.drag&&c.forEach(function(d,u){if(!(d===!1||u===0||u===c.length-1)){var _=l[u-1],S=l[u],y=[d],T=[_,S],A=[u-1,u];le(d,e.cssClasses.draggable),h.fixed&&(y.push(_.children[0]),y.push(S.children[0])),h.dragAll&&(T=l,A=w),y.forEach(function(j){re(s.start,j,qi,{handles:T,handleNumbers:A,connect:d})})}})}function Wi(h,d){L[h]=L[h]||[],L[h].push(d),h.split(".")[0]==="update"&&l.forEach(function(u,_){G("update",_)})}function eo(h){return h===Xe.aria||h===Xe.tooltips}function Et(h){var d=h&&h.split(".")[0],u=d?h.substring(d.length):h;Object.keys(L).forEach(function(_){var S=_.split(".")[0],y=_.substring(S.length);(!d||d===S)&&(!u||u===y)&&(!eo(y)||u===y)&&delete L[_]})}function G(h,d,u){Object.keys(L).forEach(function(_){var S=_.split(".")[0];h===S&&L[_].forEach(function(y){y.call(qt,E.map(e.format.to),d,E.slice(),u||!1,b.slice(),qt)})})}function Xt(h,d,u,_,S,y,T){var A;return l.length>1&&!e.events.unconstrained&&(_&&d>0&&(A=v.getAbsoluteDistance(h[d-1],e.margin,!1),u=Math.max(u,A)),S&&d1&&e.limit&&(_&&d>0&&(A=v.getAbsoluteDistance(h[d-1],e.limit,!1),u=Math.min(u,A)),S&&d1?_.forEach(function(z,M){var Q=Xt(y,z,y[z]+d,j[M],F[M],!1,A);Q===!1?d=0:(d=Q-y[z],y[z]=Q)}):j=F=[!0];var K=!1;_.forEach(function(z,M){K=We(z,u[z]+d,j[M],F[M],!1,A)||K}),K&&(_.forEach(function(z){G("update",z),G("slide",z)}),S!=null&&G("drag",T))}function zs(h,d){return e.dir?100-h-d:h}function to(h,d){b[h]=d,E[h]=v.fromStepping(d);var u=zs(d,0)-Z,_="translate("+Ki(u+"%","0")+")";l[h].style[e.transformRule]=_,Gs(h),Gs(h+1)}function zi(){w.forEach(function(h){var d=b[h]>50?-1:1,u=3+(l.length+d*h);l[h].style.zIndex=String(u)})}function We(h,d,u,_,S,y){return S||(d=Xt(b,h,d,u,_,!1,y)),d===!1?!1:(to(h,d),!0)}function Gs(h){if(!!c[h]){var d=0,u=100;h!==0&&(d=b[h-1]),h!==c.length-1&&(u=b[h]);var _=u-d,S="translate("+Ki(zs(d,_)+"%","0")+")",y="scale("+Ki(_/100,"1")+")";c[h].style[e.transformRule]=S+" "+y}}function Ys(h,d){return h===null||h===!1||h===void 0||(typeof h=="number"&&(h=String(h)),h=e.format.from(h),h!==!1&&(h=v.toStepping(h)),h===!1||isNaN(h))?b[d]:h}function Jt(h,d,u){var _=Ui(h),S=b[0]===void 0;d=d===void 0?!0:d,e.animate&&!S&&En(o,e.cssClasses.tap,e.animationDuration),w.forEach(function(A){We(A,Ys(_[A],A),!0,!1,u)});var y=w.length===1?0:1;if(S&&v.hasNoSize()&&(u=!0,b[0]=0,w.length>1)){var T=100/(w.length-1);w.forEach(function(A){b[A]=A*T})}for(;y=0&&hu.stepAfter.startValue&&(S=u.stepAfter.startValue-_),_>u.thisStep.startValue?y=u.thisStep.step:u.stepBefore.step===!1?y=!1:y=_-u.stepBefore.highestStep,d===100?S=null:d===0&&(y=null);var T=v.countStepDecimals();return S!==null&&S!==!1&&(S=Number(S.toFixed(T))),y!==null&&y!==!1&&(y=Number(y.toFixed(T))),[y,S]}function no(){return w.map(Zs)}function oo(h,d){var u=Qs(),_=["margin","limit","padding","range","animate","snap","step","format","pips","tooltips"];_.forEach(function(y){h[y]!==void 0&&(i[y]=h[y])});var S=Pn(i);_.forEach(function(y){h[y]!==void 0&&(e[y]=S[y])}),v=S.spectrum,e.margin=S.margin,e.limit=S.limit,e.padding=S.padding,e.pips?xe(e.pips):fe(),e.tooltips?C():Je(),b=[],Jt(Us(h.start)?h.start:u,d)}function ao(){a=k(o),g(e.connect,a),Zn(e.events),Jt(e.start),e.pips&&xe(e.pips),e.tooltips&&C(),x()}ao();var qt={destroy:ro,steps:no,on:Wi,off:Et,get:Qs,set:Jt,setHandle:so,reset:io,disable:yt,enable:Xi,__moveHandles:function(h,d,u){Ks(h,d,b,u)},options:i,updateOptions:oo,target:o,removePips:fe,removeTooltips:Je,getPositions:function(){return b.slice()},getTooltips:function(){return m},getOrigins:function(){return l},pips:xe};return qt}function Ba(t,e){if(!t||!t.nodeName)throw new Error("noUiSlider: create requires a single element, got: "+t);if(t.noUiSlider)throw new Error("noUiSlider: Slider was already initialized.");var i=Pn(e),s=Ua(t,i,e);return t.noUiSlider=s,s}var Rn={__spectrum:Tn,cssClasses:Cn,create:Ba};function In(t){return t.filter((e,i)=>t.indexOf(e)===i)}function Ln(t){let e={};return{to(i){let s=t.format(i);return e[s]=i,s},from(i){return e[i]}}}function js(t,e){let{min:i,max:s,from:r,to:n}=t;return i=parseFloat(i),s=parseFloat(s),i===s&&s++,r=parseFloat(r)||i,n=parseFloat(n)||s,{range:{min:i,max:s},start:[e.to(r),e.to(n)]}}function Dn(t,e,i,s={}){return Rn.create(t,O({cssPrefix:"dfd-slider-",orientation:"horizontal",direction:s.rtl?"rtl":"ltr",tooltips:!0,padding:0,connect:!0,animate:!0,step:1,keyboardSupport:!0,format:e,pips:{mode:"count",values:3,density:6,stepped:!0,format:e}},i))}function On(t,e,i){let s=getComputedStyle(t).direction==="rtl",r=t.noUiSlider.options.direction==="rtl",n=t.noUiSlider.options.orientation==="vertical",a=t.noUiSlider.getTooltips().map(c=>c.cloneNode(!0)),l=t.noUiSlider.getOrigins();a.forEach(function(c,f){c&&l[f].appendChild(c)}),t.noUiSlider.on("update",function(c,f,m,v,E){let b=[[]],w=[[]],N=[[]],L=0;a[0]&&(b[0][0]=0,w[0][0]=E[0],N[0][0]=c[0]);for(let I=1;Ie)&&(L++,b[L]=[],N[L]=[],w[L]=[]),a[I]&&(b[L].push(I),N[L].push(c[I]),w[L].push(E[I]));b.forEach(function(I,B){let q=I.length;for(let Z=0;Ztypeof r=="string"?new $s(r,o,a,s,parseInt(n,10)):i?Ni(e,i,parseInt(n,10),w):Fi(e,parseInt(l,10),w))();this.format=Ln(L),this.slider=Dn(this.el,this.format,js({min:c,max:f,from:m,to:v},this.format),{rtl:N}),this.slider.on("change",I=>{let[B,q]=I,W={index:this.el.dataset.index,range:{[t]:{from:this.format.from(B),to:this.format.from(q)}}};E?this.pushEventTo(E,"slide",W):this.pushEvent("slide",W)}),b||On(this.el,25," - ")},updated(){let{min:t,max:e,from:i,to:s}=this.el.dataset;this.slider.updateOptions(js({min:t,max:e,from:i,to:s},this.format))},destroyed(){this.el.noUiSlider.destroy()}};"use strict";var Mn={mounted(){let t=0,e=0;this.el.addEventListener("touchstart",i=>{t=i.changedTouches[0].screenY},!1),this.el.addEventListener("touchend",i=>{e=i.changedTouches[0].screenY,e>t&&this.pushEvent(this.el.dataset.action,{index:""})},!1)}};var Vi=window.SpeechRecognition||window.webkitSpeechRecognition||null,Nn=["click"],Fn=["start","end","error","result"],Va="voice-search",$n="voice-status-change";function ja(t){return t.results.length>0?t.results[0][0].transcript:null}var Un={mounted(){!Vi||(this.recording=!1,this.driver=new Vi,this.driver.continuous=!1,this.driver.interimResults=!1,this.handleVoiceEvent=t=>{switch(t.type){case"end":case"error":this.driver.stop(),this.recording=!1,this.pushEvent($n,{recording:!1});break;case"click":this.driver[this.recording?"stop":"start"](),this.recording=!this.recording,this.pushEvent($n,{recording:this.recording});break;case"result":{let e=ja(t);e&&this.pushEvent(Va,{query:e});break}}},Nn.forEach(t=>this.el.addEventListener(t,this.handleVoiceEvent)),Fn.forEach(t=>this.driver.addEventListener(t,this.handleVoiceEvent)))},destroyed(){Nn.forEach(t=>this.el.removeEventListener(t,this.handleVoiceEvent)),Fn.forEach(t=>this.driver.removeEventListener(t,this.handleVoiceEvent)),this.driver=null}};"use strict";var Bn={mounted(){this.sort=t=>{let e=t.target.selectedOptions[0];this.pushEvent("sort",{index:e.getAttribute("dfd-data-index"),field:e.getAttribute("dfd-data-field"),order:e.getAttribute("dfd-data-order")})},this.el.addEventListener("change",this.sort)},destroyed(){this.el.removeEventListener("change",this.sort)}};function de(t,e,...i){var o;let s=((o=i.find(a=>!!a.options))==null?void 0:o.options)||{},r={get tag(){return e},get options(){return s},debug(...a){H(`[hook][${t}]`,...a)}};return["mounted","beforeUpdate","updated","destroyed","disconnected","reconnected"].forEach(a=>{let l=i.map(c=>c[a]).filter(c=>!!c);r[a]=function(){l.length>0&&this.debug(`${a}()`),l.forEach(c=>c.call(this))}}),r}function Vn(t){return JSON.parse(JSON.stringify(t))}function Xs(t,e,i){let s=i.x,r=s+i.width,n=i.y,o=n+i.height;return t>=s&&t<=r&&e>=n&&e<=o}function Vt(t,e=!1){let i=Ls("__DF_LAYER_SERVER__")||`https://${t.toLowerCase()}-layer.doofinder.com`;return e?i.replace(/^http/,"ws"):i}function jn(){var t;if("maxTouchPoints"in navigator)return navigator.maxTouchPoints>0;if("msMaxTouchPoints"in navigator)return navigator.msMaxTouchPoints>0;{let e=(t=window.matchMedia)==null?void 0:t.call(window,"(pointer:coarse)");if((e==null?void 0:e.media)==="(pointer:coarse)")return!!e.matches;if("orientation"in window)return!0;{let i=navigator.userAgent;return/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(i)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(i)}}}function Js(t){let e=document.cookie.match(new RegExp("(?:^|; )"+t.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));if(e)return decodeURIComponent(e[1])}function Xn(t){if(t instanceof PointerEvent)switch(t.pointerType){case"mouse":case"pen":case"touch":return!0;default:return!1}else if(t instanceof MouseEvent){let{pageX:e,pageY:i,target:s}=t;return!(e===i&&e===0&&Xa(s))}return!1}function Xa(t){return t.getAttribute("type")==="submit"&&(t.tagName==="BUTTON"||t.tagName==="INPUT")}function qs(t){return typeof t=="undefined"?null:t}var Ja="Search",Jn=jn(),qn="latestSearches",qa=10,Wa="dfd-root",bt=class{constructor(e){this.__handleTriggerEvent__=this.__handleTriggerEvent__.bind(this),this.__handleLinkClick__=this.__handleLinkClick__.bind(this),this.__handleDocumentMousedown__=this.__handleDocumentMousedown__.bind(this),this.__handleDocumentKeyup__=this.__handleDocumentKeyup__.bind(this),this.__updateSocketParams__=this.__updateSocketParams__.bind(this),this.__afterConnect__=this.__afterConnect__.bind(this),this.__afterDisconnect__=this.__afterDisconnect__.bind(this);let{autoload:i,currency:s,exportResultsData:r,hashid:n,id:o,installationId:a,is_checkout:l,language:c,layerType:f,search_query_retention:m,trigger:v,urlHash:E,zone:b}=e;this._installationId=a,this._zone=b,this._hashid=n,this._language=c,this._currency=s,this._exportResultsData=r,this._layerType=f,l&&this.dispatch("doofinder.layer.checkout",{url:window.location.href}),this._mount=this.__createMount__(o),this._mount.addEventListener("click",this.__handleLinkClick__),this._eventBus=new Rs(this._mount.id),this._eventBusSubscriptions=[Ds,Nt,Ft,Os].map(w=>this._eventBus.on(w,this.__handleTriggerEvent__)),this._trigger=v,this._trigger.setEventBus(this._eventBus),this._display=new Ps(this._mount),this._state=this.__defineNewState__(a,i,E,f),this._data=new vt(`${a}.data`),this._sessionData=new vt(`${a}.data`,window.sessionStorage),this._params=this.__buildSocketParams__(e),this._hooks=this.__buildSocketHooks__(e),this._connection=null,this._connectedPromise=new De,this._theme=null,this._searchQueryRetention=m,this._urlHash=E,this._autoload=i,this.closable&&this.mount.classList.add("dfd-closable"),this._trigger.flushMessages(),this.__loadState__().then(()=>this.dispatch("doofinder.ready"))}__createMount__(e){let i=document.createElement("div");return i.id=e||`df-${Ai(32)}`,i.dataset.dfdView=Ja,i.setAttribute(Me,""),i.classList.add(Wa),Object.defineProperty(i,"doofinderTag",{value:this,writable:!1}),i}get mount(){return this._mount}get trigger(){return this._trigger}get display(){return this._display}get hashid(){return this._hashid}get installationId(){return this._installationId}get zone(){return this._zone}get language(){return this._language}get currency(){return this._currency}get exportResultsData(){return this._exportResultsData}get layerType(){return this._layerType}get searchQueryRetention(){return this._searchQueryRetention}get data(){return this._data}get state(){return this._state}get closable(){return this.display.type!==tt||!this._state.hasAutoloadQueryParam}set targetItemId(e){this.state.targetItemId=e}enableDebug(){return this._connection?(this._connection.enableDebug(),!0):!1}debug(...e){H("[tag]",...e)}updateState({value:e=this._state.targetItemId,itemId:i=this._state.targetItemId,isTransitory:s=this._state.isTransitory}){this._state.update(e,i,s)}__handleTriggerEvent__(e){let{source:i,originalEvent:s}=e.detail,{query:r}=e.detail,n=r?{query:r}:{};this.connect(n).then(()=>{this.__shouldDisplay__(e)?(this.show(i),e.type===Ft&&this.search(r)):e.type===Os&&this.submit(r,o=>{var l;if(!o)return;let{submit:a}=o||{};a&&((l=s==null?void 0:s.target.closest("form"))==null||l.submit())})})}__shouldDisplay__(e){let{query:i}=e.detail;switch(this._display.type){case yi:return(e.type===Ft||e.type===Nt)&&(this._display.screenType==="classic-initial"||!!i);case tt:return(e.type===Ft||e.type===Nt)&&!!i;case Si:return e.type===Ds||e.type===Nt;default:return!1}}__handleLinkClick__(e){var r,n;if(e.target.href===window.location.href){e.preventDefault(),this.__closeAndPreserveQuery__();return}if(!e.target.href){(r=this._connection)==null||r.setPreventReconnect(!1);return}let i=e.target.closest("[dfd-value-dfid]"),s=i==null?void 0:i.getAttribute("dfd-value-dfid");s&&this.updateState({itemId:s}),(n=this._connection)==null||n.setPreventReconnect(!0),this._layerType!=="category_pages"&&this._searchQueryRetention&&this._state.saveTransitory(e.target.href)}__closeAndPreserveQuery__(){if(this.searchQueryRetention){let e=this._state.query;setTimeout(()=>{this._trigger.updateQuery(e)},300)}this.close()}__handleDocumentMousedown__(e){if(this._display.hidden||this._display.type===tt||!Xn(e))return;let{clientX:i,clientY:s}=e;if(Xs(i,s,this._mount.getBoundingClientRect()))return;let r=this._display.method.positionReference;!!r&&(Xs(i,s,r.getBoundingClientRect())||e.target.closest('button[type="submit"]')&&e.target.closest("form")===r.closest("form"))||this.close()}__handleDocumentKeyup__(e){var i;e.key==="Escape"&&this.layerType!=="category_pages"&&((i=document.activeElement)==null||i.blur(),this.close())}__loadState__(){if(this._layerType==="category_pages"||(this.debug("load state:",this._state.value),this._trigger.updateQuery(this._searchQueryRetention?this._state.query:""),!this._state.value))return Promise.resolve();let e=this._state.value;return this.connect({state:e}).then(()=>{this._state.isTransitory?this.debug("Layer not opened because the state is transitory"):this.show()})}getLatestSearches(){return this._data.getItem(qn)||[]}updateLatestSearches(e){this._data.setItem(qn,e)}onLoad(e){let{min_capture_length:i,capture_submit:s,align:r,display_type:n,insertion_point:o,insertion_method:a,screen_type:l,theme:c}=e;this.__updateTrigger__({min_capture_length:i,capture_submit:s}),this.__updateDisplay__({display_type:n,insertion_point:o,insertion_method:a,screen_type:l,theme:c,align:r}),this._connectedPromise.resolve(e)}__updateTrigger__({min_capture_length:e,capture_submit:i}){this._trigger.setCaptureLength(e),this._trigger.captureSubmit=i}__updateDisplay__({display_type:e,insertion_point:i,insertion_method:s,screen_type:r,theme:n,align:o}){this._display.setType(e,{placement:{insertionPoint:i,insertionMethod:s},align:o}),this._display.screenType=r,this._display.updateTheme(n),this._display.hidden||this.updatePosition()}updatePosition(e){return P(this,null,function*(){this._display.updatePosition({positionReference:e||(yield this._trigger.getElement())})})}close(){var e,i;this.closable&&((i=(e=this.getHooksByName("Layer"))==null?void 0:e.pop())==null||i.close())}show(e){return P(this,null,function*(){yield this.updatePosition(e),yield this._display.show(),this.updateState({isTransitory:!1}),setTimeout(()=>{var i;return(i=this._connection)==null?void 0:i.pushEvent("update-scroll")},200),this.dispatch("doofinder.show")})}hide(){return P(this,null,function*(){this._display&&(yield this._display.hide()),this.dispatch("doofinder.hide")})}dispatch(e,i={}){let s=Ce(O({},i),{tag:this});document.dispatchEvent(new CustomEvent(e,{detail:s}))}connect(e){return this._connection||(this.debug(`creating live socket for layer: ${this._mount.id}`),this._connection=new Ss(this.__connectionSetup__(e)),this._connection.connect(this.__afterConnect__)),this._connectedPromise}isConnected(){return this._connection?this._connection.connected:!1}open(){return P(this,arguments,function*(e={}){let{search:i,screen:s}=e,r=O({},e);i!=null&&!s&&(r.screen="fallback"),typeof i=="string"&&(delete r.search,r.query=i),yield this.connect(r),yield this.show(),typeof i=="object"&&this.search(i)})}openCategoryPages(e){return P(this,null,function*(){let{search:i}=e,s={search:i},r=this._state.value;r&&(s.state=r),H("[category pages] connect with",s),yield this.connect(s),yield this.show(),r||(H("[category pages] no state, opening with: ",i),this.search(i))})}disconnect(){var e;this.layerType!=="category_pages"&&(this.debug(`disconnecting from live socket: ${this._mount.id}`),this._trigger.updateQuery(""),this.updateState({value:"",itemId:null,isTransitory:!1}),this.hide(),(e=this._connection)==null||e.disconnect(this.__afterDisconnect__),this._connection=null,this._connectedPromise=new De)}destroy(){return P(this,null,function*(){var e;this.debug(`destroy: ${this._mount.id}`),this.hide(),(e=this._connection)==null||e.disconnect(this.__afterDisconnect__),this._connection=null,this._eventBusSubscriptions.forEach(i=>i()),this._eventBusSubscriptions=null,this._eventBus.teardown(),this._eventBus=null,yield this._display.destroy(),this._display=null,this._trigger.destroy(),this._mount.replaceChildren(),this.dispatch("doofinder.destroy")})}getHooksByName(e){var i;return(i=this._connection)==null?void 0:i.getHooksByName(e)}search(e,i){var r;let s=typeof e=="string"?{query:e}:e;(r=this._connection)==null||r.pushEvent("search-suggest",{search:s},i)}changeLocale(e,i,s){var r;(r=this._connection)==null||r.pushEvent("change-locale",{language:e,currency:i},s)}submit(e,i){var s;(s=this._connection)==null||s.pushEvent("search-submit",{search:{query:e}},i)}__buildSocketParams__(e){let{params:i,sort:s,vars:r,indices:n,state:o,priceName:a}=e,l={hashid:this._hashid,origin:window.location.hostname,indices:n,params:i,sort:s,vars:r,state:o,price_name:a};return["indices","search-server"].filter(c=>!l[c]).forEach(c=>delete l[c]),l}__buildSocketHooks__(e){let i=e.hooks||{},s={Carousel:de("Carousel",this,Zr,i.Carousel||{}),ImageSearch:de("ImageSearch",this,sn),Input:de("Input",this,nn,i.Input||{}),Layer:de("Layer",this,dn,i.Layer||{}),LayerNotAvailable:de("LayerNotAvailable",this,un),AddToCart:de("AddToCart",this,on,i.AddToCart||{}),EmbeddedResults:de("EmbeddedResults",this,Fs,Jn?Ns:{},i.EmbeddedResults||{}),Results:de("Results",this,bn,Jn?Ns:{},Fs,i.Results||{}),Slider:de("Slider",this,Hn,i.Slider||{}),Swipe:de("Swipe",this,Mn,i.Swipe||{}),VoiceSearch:de("VoiceSearch",this,Un,i.VoiceSearch||{}),SortSelect:de("SortSelect",this,Bn)};return H("[tag] Hooks created:",this._mount.id,s),Object.keys(i).filter(r=>!s[r]).forEach(r=>{s[r]=de(r,this,i[r]||{})}),s}__connectionSetup__(e){return{url:`${Vt(this._zone,!0)}/layer/${rt}`,mount:this._mount,hooks:this._hooks,mainHook:"Layer",params:()=>this.__updateSocketParams__(e),appName:"layer",disconnectCallback:(()=>{this.debug("layer died and can't reconnect automatically! \u{1F92C}"),this.__afterDisconnect__()}).bind(this)}}__updateSocketParams__(e){var s,r,n,o;let i=Ce(O({},Vn(this._params)),{zone:this.zone,installation_id:this.installationId,language:this.language,currency:this.currency,session_id:Doofinder.Session.getSessionId(),tab_id:"getTabId"in Doofinder.Session?Doofinder.Session.getTabId():null,session_alive:Doofinder.Session.isLive("layer"),user_id:Doofinder.Session.getUserId(),latest_searches:this.getLatestSearches(),voice_supported:!!Vi,export_results_data:qs((s=this.exportResultsData)==null?void 0:s.slice(0,qa)),ga_client_id:qs((r=Js("_ga"))==null?void 0:r.substring(6)),layer_type:this.layerType,state:this._state.value,mount_id:this._mount.id,current_url:window.location.href});return this._layerType==="category_pages"&&(i.search=e.search),((n=this._connection)==null?void 0:n.connected)||(i=O(O({},i),e)),this.debug(`__updateSocketParams__ for layer: ${this._mount.id}`,i," socket connected? ",(o=this._connection)==null?void 0:o.connected," overrides: ",e," current state",this._state.value),i}__afterConnect__(){document.addEventListener("mousedown",this.__handleDocumentMousedown__),document.addEventListener("keyup",this.__handleDocumentKeyup__,{passive:!0})}__afterDisconnect__(){document.removeEventListener("keyup",this.__handleDocumentKeyup__),document.removeEventListener("mousedown",this.__handleDocumentMousedown__),this.dispatch("doofinder.disconnect")}__defineNewState__(e,i,s,r){return new st({installationId:e,autoload:i,urlHash:s,layerType:r})}};var Ka=Object.freeze({language(t){let e=(t==null?void 0:t.replaceAll("_","-").trim().split("-"))||[];function i(s){return s?`-${s.toUpperCase()}`:""}if(e.length<3){let[s,r]=e;return`${s==null?void 0:s.toLowerCase()}${i(r)}`}else{let[s,r,n]=e;return`${s==null?void 0:s.toLowerCase()}-${r.toUpperCase()}${i(n)}`}},currency(t){return t==null?void 0:t.trim().toUpperCase()}});function Ws(t){return P(this,null,function*(){let e=document.createElement("style");e.appendChild(document.createTextNode((t||"").trim())),document.head.appendChild(e)})}function Wn(t){return P(this,null,function*(){var o;let e=Ga(t);H("[category pages] displayForSeo options: ",t,"params: ",e);let i=yield Ya(e);if(H("[category pages] displayForSeo htmlContent: ",i),!i)return;let s=za(t.id,i);t.device=="mobile"&&(s.classList.remove("dfd-embedded"),s.classList.add("dfd-mobile_embedded")),t.custom_css.forEach(Ws);let r=(o=t.custom_properties)==null?void 0:o.join(` `);Ws(`#${s.id} { ${r||""} }`);let n=document.querySelector(t.insertion_point);n&&n.replaceWith(s)})}function za(t,e){let i=bt.__createMount__(t);return i.insertAdjacentHTML("afterbegin",e),i}function Ga(t){let{installationId:e,hashid:i,language:s,currency:r,zone:n,search:o,sort:a,urlHash:l,vars:c,layerType:f,autoload:m,priceName:v}=t,E=Doofinder.Session.getSessionId(),b=Doofinder.Session.getUserId(),w=new st({installationId:e,autoload:m,urlHash:l,layerType:f}).value;return{installationId:e,hashid:i,language:s,currency:r,zone:n,state:w,search:o,sort:a,price_name:v,session_id:E,user_id:b,vars:c}}function Ya(t){return P(this,null,function*(){let{zone:e}=t,i=Vt(e),s=new URL(`${i}/api/${rt}/categorypage`);return Object.keys(t).forEach(function(n){let o=t[n];typeof o=="undefined"||o==null||(typeof o=="object"&&(o=JSON.stringify(o)),s.searchParams.append(n,o))}),yield fetch(s).then(function(n){return n.ok?n.text():""})})}var ji=[];document.addEventListener("doofinder.destroy",t=>{ji=ji.filter(e=>e!==t.detail)});var Kn={getTags(){return ji.slice(0)},create(t){let e=new bt(t);return t.forceOpen&&t.layerType==="category_pages"&&(Wn(t),e.openCategoryPages(t)),ji.push(e),e},destroy(t){var e;t instanceof bt?t.destroy():(e=t==null?void 0:t.doofinderTag)==null||e.destroy()},enableDebug:Wr,disableDebug:Kr,debug:H,utils:{buildNumericFormatter:Fi,buildCurrencyFormatter:Ni}};Object.defineProperty(Kn,"__version__",{value:rt});ar(or,Kn);})();